From 3126d64e5f04cd39033f8c5055e80440b8680d86 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 5 Nov 2019 23:02:31 +0900 Subject: [PATCH] sd-device-enumerator: do not return error when a device is removed Fixes #13814. --- src/libsystemd/sd-device/device-enumerator.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 5b54641..a1932f4 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -506,7 +506,10 @@ static int enumerator_scan_dir_and_add_devices(sd_device_enumerator *enumerator, initialized = sd_device_get_is_initialized(device); if (initialized < 0) { - r = initialized; + if (initialized != -ENOENT) + /* this is necessarily racey, so ignore missing devices */ + r = initialized; + continue; } @@ -639,7 +642,9 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c k = sd_device_get_subsystem(device, &subsystem); if (k < 0) { - r = k; + if (k != -ENOENT) + /* this is necessarily racy, so ignore missing devices */ + r = k; continue; } -- 2.7.4