diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-09 05:25:55 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-09 22:30:19 +0900 |
commit | e0993236d30a7f5a2dec1fd0e1b737879f209232 (patch) | |
tree | ef42c79262e7300a69929449549467c2eace9eb2 /src | |
parent | cb456374e096f0ebe9b70d7ddd98e16a4be24ee6 (diff) | |
download | systemd-e0993236d30a7f5a2dec1fd0e1b737879f209232.tar.gz |
blockdevi-util: also check sysname when enumerating partitions
Diffstat (limited to 'src')
-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; |