From e6724664c3d8fa8669746192f647c1845f9857ff Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 22 Apr 2024 10:16:40 +0200 Subject: [PATCH] fd-util: Return 1 from fd_nonblock() if we actually change the mode --- src/basic/fd-util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 5d005302969..121e6cd2190 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -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) {