diff options
author | Bojan Smojver <bojan@apache.org> | 2009-02-27 01:34:54 +0000 |
---|---|---|
committer | Bojan Smojver <bojan@apache.org> | 2009-02-27 01:34:54 +0000 |
commit | 4c761b60b4dccf2cee852cca069a5c6555e37ab7 (patch) | |
tree | 7ca2ebc9d67b5690d45809c2ac91f7fd9cf210bf /network_io | |
parent | b26bce8d916143232af33b112f2a82b96fa5d732 (diff) | |
download | apr-4c761b60b4dccf2cee852cca069a5c6555e37ab7.tar.gz |
Unroll APR_SET_FD_CLOEXEC macro.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@748371 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/unix/sockets.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index a46b6a443..985256346 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -165,7 +165,16 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, set_socket_vars(*new, family, type, oprotocol); #ifndef HAVE_SOCK_CLOEXEC - APR_SET_FD_CLOEXEC((*new)->socketdes); + { + int flags; + + if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) + return errno; + + flags |= FD_CLOEXEC; + if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) + return errno; + } #endif (*new)->timeout = -1; @@ -313,7 +322,16 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, } #ifndef HAVE_ACCEPT4 - APR_SET_FD_CLOEXEC((*new)->socketdes); + { + int flags; + + if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) + return errno; + + flags |= FD_CLOEXEC; + if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) + return errno; + } #endif (*new)->inherit = 0; |