aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-08-02 10:04:21 -0400
committerNick Mathewson <nickm@torproject.org>2013-08-02 10:04:21 -0400
commite25eb35f11b0419fe50791b3760f1d4016bf8a8b (patch)
tree818bceab3c7c4a075f7fd776db086c4fc9e9af4c /src/common/compat.c
parentebd4ab1506517b32ee3bd5bd1597b4373aa56ee7 (diff)
downloadtor-e25eb35f11b0419fe50791b3760f1d4016bf8a8b.tar
tor-e25eb35f11b0419fe50791b3760f1d4016bf8a8b.tar.gz
Actually use the cloexec argument in the !defined(SOCK_CLOEXEC) case
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index af8f2884d..8aab12a30 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