diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-08 22:25:55 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-09 15:30:19 +0200 |
commit | e0993236d30a7f5a2dec1fd0e1b737879f209232 (patch) | |
tree | ef42c79262e7300a69929449549467c2eace9eb2 /src/shared/blockdev-util.c | |
parent | Implement DNS notifications from resolved via varlink (diff) | |
download | systemd-e0993236d30a7f5a2dec1fd0e1b737879f209232.tar.xz systemd-e0993236d30a7f5a2dec1fd0e1b737879f209232.zip |
blockdevi-util: also check sysname when enumerating partitions
Diffstat (limited to 'src/shared/blockdev-util.c')
-rw-r--r-- | src/shared/blockdev-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/blockdev-util.c b/src/shared/blockdev-util.c index 66807c673d..82893a0516 100644 --- a/src/shared/blockdev-util.c +++ b/src/shared/blockdev-util.c @@ -543,6 +543,16 @@ static int partition_enumerator_new(sd_device *dev, sd_device_enumerator **ret) if (r < 0) return r; + r = sd_device_get_sysname(dev, &s); + if (r < 0) + return r; + + /* Also add sysname check for safety. Hopefully, this also improves performance. */ + s = strjoina(s, "*"); + r = sd_device_enumerator_add_match_sysname(e, s); + if (r < 0) + return r; + r = sd_device_enumerator_add_match_subsystem(e, "block", /* match = */ true); if (r < 0) return r; |