[or-cvs] [tor/master 9/9] Check that FD_CLOEXEC is set before using it

nickm at torproject.org nickm at torproject.org
Wed Dec 1 16:39:16 UTC 2010


Author: Steven Murdoch <Steven.Murdoch at cl.cam.ac.uk>
Date: Wed, 1 Dec 2010 15:43:17 +0000
Subject: Check that FD_CLOEXEC is set before using it
Commit: a961521a86c439ab2ba1073daa6392a069903db1

I don't know if any platforms we care about don't have FD_CLOEXEC,
but this is what we do elsewhere
---
 src/common/compat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/common/compat.c b/src/common/compat.c
index 56315e5..123a1ea 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)
-- 
1.7.1



More information about the tor-commits mailing list