diff options
author | Renato Botelho <renato@netgate.com> | 2015-10-13 13:45:58 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-10-13 13:45:58 -0300 |
commit | e52aa5f667faebee85874ec39c29fa1257dd554f (patch) | |
tree | b08cff1a8d0fb8f667942aca5b9a8be9fb5dca03 /contrib/apr/network_io/unix/sockets.c | |
parent | 945ed01c4bae06169f63978e43029c04d4abd731 (diff) | |
parent | 8096b85f202b18e1be6a5dd5251a10fcdb255a78 (diff) | |
download | FreeBSD-src-e52aa5f667faebee85874ec39c29fa1257dd554f.zip FreeBSD-src-e52aa5f667faebee85874ec39c29fa1257dd554f.tar.gz |
Merge branch 'stable/10' into devel
Diffstat (limited to 'contrib/apr/network_io/unix/sockets.c')
-rw-r--r-- | contrib/apr/network_io/unix/sockets.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/contrib/apr/network_io/unix/sockets.c b/contrib/apr/network_io/unix/sockets.c index 514edb1..b95794f 100644 --- a/contrib/apr/network_io/unix/sockets.c +++ b/contrib/apr/network_io/unix/sockets.c @@ -145,13 +145,22 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, #ifndef HAVE_SOCK_CLOEXEC { int flags; + apr_status_t rv; - if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) - return errno; + if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) { + rv = errno; + close((*new)->socketdes); + (*new)->socketdes = -1; + return rv; + } flags |= FD_CLOEXEC; - if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) - return errno; + if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) { + rv = errno; + close((*new)->socketdes); + (*new)->socketdes = -1; + return rv; + } } #endif @@ -306,13 +315,22 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, #ifndef HAVE_ACCEPT4 { int flags; + apr_status_t rv; - if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) - return errno; + if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) { + rv = errno; + close((*new)->socketdes); + (*new)->socketdes = -1; + return rv; + } flags |= FD_CLOEXEC; - if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) - return errno; + if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) { + rv = errno; + close((*new)->socketdes); + (*new)->socketdes = -1; + return rv; + } } #endif |