diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index fabf3b2e2ec..fb8df16ebc3 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -127,10 +127,18 @@ static int enumerator_for_parent(sd_device *d, sd_device_enumerator **ret) { if (r < 0) return r; + r = sd_device_enumerator_add_match_subsystem(e, "block", true); + if (r < 0) + return r; + r = sd_device_enumerator_add_match_parent(e, d); if (r < 0) return r; + r = sd_device_enumerator_add_match_sysattr(e, "partition", NULL, true); + if (r < 0) + return r; + *ret = TAKE_PTR(e); return 0; } @@ -151,9 +159,6 @@ static int device_is_partition(sd_device *d, blkid_partition pp) { return false; r = sd_device_get_sysattr_value(d, "partition", &v); - if (r == -ENOENT || /* Not a partition device */ - ERRNO_IS_PRIVILEGE(r)) /* Not ready to access? */ - return false; if (r < 0) return r; r = safe_atoi(v, &partno); @@ -313,6 +318,14 @@ static int wait_for_partition_device( if (r < 0) return r; + r = sd_device_monitor_filter_add_match_parent(monitor, parent, true); + if (r < 0) + return r; + + r = sd_device_monitor_filter_add_match_sysattr(monitor, "partition", NULL, true); + if (r < 0) + return r; + r = sd_device_monitor_attach_event(monitor, event); if (r < 0) return r;