]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/fdset.c
util-lib: split our string related calls from util.[ch] into its own file string...
[thirdparty/systemd.git] / src / basic / fdset.c
index 6101b628ec2fd245656c50e01324f6ee6cf7c0af..2882f515b59886ae4760a299d9f5fcd543f501d7 100644 (file)
 #include <dirent.h>
 #include <fcntl.h>
 
+#include "sd-daemon.h"
+
 #include "set.h"
 #include "util.h"
 #include "macro.h"
 #include "fdset.h"
-#include "sd-daemon.h"
 
 #define MAKE_SET(s) ((Set*) s)
 #define MAKE_FDSET(s) ((FDSet*) s)
@@ -201,9 +202,11 @@ int fdset_cloexec(FDSet *fds, bool b) {
 
         assert(fds);
 
-        SET_FOREACH(p, MAKE_SET(fds), i)
-                if ((r = fd_cloexec(PTR_TO_FD(p), b)) < 0)
+        SET_FOREACH(p, MAKE_SET(fds), i) {
+                r = fd_cloexec(PTR_TO_FD(p), b);
+                if (r < 0)
                         return r;
+        }
 
         return 0;
 }
@@ -267,8 +270,7 @@ bool fdset_isempty(FDSet *fds) {
 int fdset_iterate(FDSet *s, Iterator *i) {
         void *p;
 
-        p = set_iterate(MAKE_SET(s), i);
-        if (!p)
+        if (!set_iterate(MAKE_SET(s), i, &p))
                 return -ENOENT;
 
         return PTR_TO_FD(p);