From 21c7fe6d125f8af6ad6b305d2a615be626a2a9f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 5 Jul 2020 10:55:18 +0200 Subject: [PATCH] sd-device: be more defensive in FOREACH_DEVICE_SYSATTR Follow-up for fadcc1222949ed57ca2ce143f2eb9b93ea0dab1b. --- src/libsystemd/sd-device/sd-device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 05e3a54c100..13596f23035 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1585,6 +1585,10 @@ static int device_sysattrs_read_all_internal(sd_device *device, const char *subd if (access(p, F_OK) >= 0) /* this is a child device, skipping */ return 0; + if (errno != ENOENT) { + log_debug_errno(errno, "Failed to stat %s, ignoring subdir: %m", p); + return 0; + } path_dir = path_join(syspath, subdir); if (!path_dir) -- 2.47.3