diff --git a/mongoose.c b/mongoose.c index 80a7df48..1c236204 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3045,8 +3045,8 @@ static void mg_set_non_blocking_mode(SOCKET fd) { #elif MG_ARCH == MG_ARCH_AZURERTOS fcntl(fd, F_SETFL, O_NONBLOCK); #else - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); // Set non-blocking mode - fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); // Non-blocking mode + fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec #endif } diff --git a/src/sock.c b/src/sock.c index d103b024..d13a22c9 100644 --- a/src/sock.c +++ b/src/sock.c @@ -174,8 +174,8 @@ static void mg_set_non_blocking_mode(SOCKET fd) { #elif MG_ARCH == MG_ARCH_AZURERTOS fcntl(fd, F_SETFL, O_NONBLOCK); #else - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); // Set non-blocking mode - fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); // Non-blocking mode + fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec #endif }