summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-device
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-device')
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 71ab3d8..00d3328 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -701,13 +701,11 @@ static int enumerator_scan_dir_and_add_devices(
dir = opendir(path);
if (!dir) {
- bool ignore = errno == ENOENT;
+ /* This is necessarily racey, so ignore missing directories */
+ if (errno == ENOENT)
+ return 0;
- /* this is necessarily racey, so ignore missing directories */
- log_debug_errno(errno,
- "sd-device-enumerator: Failed to open directory %s%s: %m",
- path, ignore ? ", ignoring" : "");
- return ignore ? 0 : -errno;
+ return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {
@@ -767,12 +765,10 @@ static int enumerator_scan_dir(
dir = opendir(path);
if (!dir) {
- bool ignore = errno == ENOENT;
+ if (errno == ENOENT)
+ return 0;
- log_debug_errno(errno,
- "sd-device-enumerator: Failed to open directory %s%s: %m",
- path, ignore ? ", ignoring" : "");
- return ignore ? 0 : -errno;
+ return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {
@@ -804,12 +800,10 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
dir = opendir(path);
if (!dir) {
- bool ignore = errno == ENOENT;
+ if (errno == ENOENT)
+ return 0;
- log_debug_errno(errno,
- "sd-device-enumerator: Failed to open directory %s%s: %m",
- path, ignore ? ", ignoring" : "");
- return ignore ? 0 : -errno;
+ return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
/* TODO: filter away subsystems? */
@@ -892,12 +886,10 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
dir = opendir(path);
if (!dir) {
- bool ignore = errno == ENOENT;
+ if (errno == ENOENT)
+ return 0;
- log_debug_errno(errno,
- "sd-device-enumerator: Failed to open directory %s%s: %m",
- path, ignore ? ", ignoring" : "");
- return ignore ? 0 : -errno;
+ return log_debug_errno(errno, "sd-device-enumerator: Failed to open directory '%s': %m", path);
}
FOREACH_DIRENT_ALL(de, dir, return -errno) {