]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device-enumerator: do not return error when a device is removed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Nov 2019 14:02:31 +0000 (23:02 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Nov 2019 21:13:11 +0000 (22:13 +0100)
Fixes #13814.

src/libsystemd/sd-device/device-enumerator.c

index 5b54641213ee180d250e939957e91bb032a5f20a..a1932f41f9b7f811085dc1e2ecff36b8d028d426 100644 (file)
@@ -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;
                 }