]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fd-util: Return 1 from fd_nonblock() if we actually change the mode
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 22 Apr 2024 08:16:40 +0000 (10:16 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 22 Apr 2024 13:28:26 +0000 (15:28 +0200)
src/basic/fd-util.c

index 5d0053029698bab308869047de40dccb2119062c..121e6cd219055a9e7b23a67f673e15184e46cf71 100644 (file)
@@ -167,7 +167,10 @@ int fd_nonblock(int fd, bool nonblock) {
         if (nflags == flags)
                 return 0;
 
-        return RET_NERRNO(fcntl(fd, F_SETFL, nflags));
+        if (fcntl(fd, F_SETFL, nflags) < 0)
+                return -errno;
+
+        return 1;
 }
 
 int stdio_disable_nonblock(void) {