From: Nick Mathewson Date: Fri, 2 Aug 2013 14:04:21 +0000 (-0400) Subject: Actually use the cloexec argument in the !defined(SOCK_CLOEXEC) case X-Git-Tag: tor-0.2.5.1-alpha~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e25eb35f11b0419fe50791b3760f1d4016bf8a8b;p=thirdparty%2Ftor.git Actually use the cloexec argument in the !defined(SOCK_CLOEXEC) case --- diff --git a/src/common/compat.c b/src/common/compat.c index af8f2884dc..8aab12a30e 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1084,10 +1084,12 @@ tor_open_socket_with_extensions(int domain, int type, int protocol, return s; #if defined(FD_CLOEXEC) - if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) { - log_warn(LD_FS,"Couldn't set FD_CLOEXEC: %s", strerror(errno)); - tor_close_socket_simple(s); - return TOR_INVALID_SOCKET; + if (cloexec) { + if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) { + log_warn(LD_FS,"Couldn't set FD_CLOEXEC: %s", strerror(errno)); + tor_close_socket_simple(s); + return TOR_INVALID_SOCKET; + } } #endif