]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-device/device-enumerator.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / libsystemd / sd-device / device-enumerator.c
index 62d03ae00d144f77bb8c95ce565f918374b2b4eb..04f50e2ad06e42e32a7433aa4c00c353b572fd17 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -631,10 +632,8 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
         if (!dir) {
                 if (errno == ENOENT)
                         return 0;
-                else {
-                        log_error("sd-device-enumerator: could not open tags directory %s: %m", path);
-                        return -errno;
-                }
+                else
+                        return log_error_errno(errno, "sd-device-enumerator: could not open tags directory %s: %m", path);
         }
 
         /* TODO: filter away subsystems? */
@@ -758,10 +757,8 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
         int r = 0;
 
         dir = opendir(path);
-        if (!dir) {
-                log_debug("sd-device-enumerate: could not open parent directory %s: %m", path);
-                return -errno;
-        }
+        if (!dir)
+                return log_debug_errno(errno, "sd-device-enumerate: could not open parent directory %s: %m", path);
 
         FOREACH_DIRENT_ALL(dent, dir, return -errno) {
                 _cleanup_free_ char *child = NULL;
@@ -773,7 +770,7 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
                 if (dent->d_type != DT_DIR)
                         continue;
 
-                child = strjoin(path, "/", dent->d_name, NULL);
+                child = strjoin(path, "/", dent->d_name);
                 if (!child)
                         return -ENOMEM;