CLEANUP: tree-wide: use fd_set_nonblock() and fd_set_cloexec()
This gets rid of most open-coded fcntl() calls, some of which were passed
through DISGUISE() to avoid a useless test. The FD_CLOEXEC was most often
set without preserving previous flags, which could become a problem once
new flags are created. Now this will not happen anymore.
diff --git a/src/sock_inet.c b/src/sock_inet.c
index fa04dfe..46cc16a 100644
--- a/src/sock_inet.c
+++ b/src/sock_inet.c
@@ -11,7 +11,6 @@
*/
#include <errno.h>
-#include <fcntl.h>
#include <string.h>
#include <unistd.h>
@@ -319,7 +318,7 @@
goto bind_close_return;
}
- if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
+ if (fd_set_nonblock(fd) == -1) {
err |= ERR_FATAL | ERR_ALERT;
memprintf(errmsg, "cannot make socket non-blocking");
goto bind_close_return;