diff options
Diffstat (limited to 'src/libstddjb/socket_internal.c')
-rw-r--r-- | src/libstddjb/socket_internal.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstddjb/socket_internal.c b/src/libstddjb/socket_internal.c index 848b156..852f323 100644 --- a/src/libstddjb/socket_internal.c +++ b/src/libstddjb/socket_internal.c @@ -3,13 +3,16 @@ #include <skalibs/sysdeps.h> #include <skalibs/nonposix.h> #include <sys/socket.h> +#include <fcntl.h> + #include <skalibs/djbunix.h> +#include <skalibs/socket.h> #ifdef SKALIBS_HASACCEPT4 int socket_internal (int domain, int type, int protocol, unsigned int flags) { - return socket(domain, type | ((flags & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((flags & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0), protocol) ; + return socket(domain, type | ((flags & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((flags & O_CLOEXEC) ? SOCK_CLOEXEC : 0), protocol) ; } #else @@ -18,8 +21,8 @@ int socket_internal (int domain, int type, int protocol, unsigned int flags) { int s = socket(domain, type, protocol) ; if (s == -1) return -1 ; - if ((((flags & DJBUNIX_FLAG_NB) ? ndelay_on(s) : ndelay_off(s)) < 0) - || (((flags & DJBUNIX_FLAG_COE) ? coe(s) : uncoe(s)) < 0)) + if ((((flags & O_NONBLOCK) ? ndelay_on(s) : ndelay_off(s)) < 0) + || (((flags & O_CLOEXEC) ? coe(s) : uncoe(s)) < 0)) { fd_close(s) ; return -1 ; |