]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fdset: minor modernizations
authorLennart Poettering <lennart@poettering.net>
Tue, 23 May 2023 18:45:40 +0000 (20:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 May 2023 18:46:13 +0000 (20:46 +0200)
src/shared/fdset.c

index 86b3139999ed9e2b47ea414c0702629e99cfa06a..397918c20bbdde921fb8ef2fc8d7e612ef5a9140 100644 (file)
@@ -163,11 +163,14 @@ int fdset_new_fill(
                 return -ENOMEM;
 
         FOREACH_DIRENT(de, d, return -errno) {
-                int fd = -EBADF;
+                int fd;
 
-                r = safe_atoi(de->d_name, &fd);
-                if (r < 0)
-                        return r;
+                if (!IN_SET(de->d_type, DT_LNK, DT_UNKNOWN))
+                        continue;
+
+                fd = parse_fd(de->d_name);
+                if (fd < 0)
+                        return fd;
 
                 if (fd < 3)
                         continue;