[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master 5/9] Don't both open the socket with SOCK_CLOEXEC and set FD_CLOEXEC
Author: Steven Murdoch <Steven.Murdoch@xxxxxxxxxxxx>
Date: Sun, 21 Nov 2010 15:40:17 +0000
Subject: Don't both open the socket with SOCK_CLOEXEC and set FD_CLOEXEC
Commit: 15f2b7859bbf66ca74cc240e89ba02c81d95cb02
---
src/common/compat.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/common/compat.c b/src/common/compat.c
index 07d9618..56315e5 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -935,11 +935,12 @@ tor_open_socket(int domain, int type, int protocol)
{
int s;
#ifdef SOCK_CLOEXEC
+#define LINUX_CLOEXEC_OPEN_SOCKET
type |= SOCK_CLOEXEC;
#endif
s = socket(domain, type, protocol);
if (s >= 0) {
-#ifdef FD_CLOEXEC
+#if !defined(LINUX_CLOEXEC_OPEN_SOCKET) && defined(FD_CLOEXEC)
fcntl(s, F_SETFD, FD_CLOEXEC);
#endif
socket_accounting_lock();
--
1.7.1