aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2010-12-01 15:43:17 +0000
committerSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2010-12-01 15:43:17 +0000
commita961521a86c439ab2ba1073daa6392a069903db1 (patch)
tree216a424e06c8323d58c92e764b51ae7a879f54b3
parent367794ce02d696c2b62d0cca5d3e7a1211c0c28a (diff)
downloadtor-a961521a86c439ab2ba1073daa6392a069903db1.tar.gz
tor-a961521a86c439ab2ba1073daa6392a069903db1.zip
Check that FD_CLOEXEC is set before using it
I don't know if any platforms we care about don't have FD_CLOEXEC, but this is what we do elsewhere
-rw-r--r--src/common/compat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 56315e5079..123a1ea241 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -1026,7 +1026,7 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
#endif
r = socketpair(family, type, protocol, fd);
if (r == 0) {
-#ifndef SOCK_CLOEXEC
+#if !defined(SOCK_CLOEXEC) && defined(FD_CLOEXEC)
if (fd[0] >= 0)
fcntl(fd[0], F_SETFD, FD_CLOEXEC);
if (fd[1] >= 0)