Browse Source

Merge remote branch 'sjmurdoch/cloexec' into cloexec

Nick Mathewson 15 years ago
parent
commit
f04d7e6009
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/common/compat.c

+ 2 - 1
src/common/compat.c

@@ -935,11 +935,12 @@ tor_open_socket(int domain, int type, int protocol)
 {
 {
   int s;
   int s;
 #ifdef SOCK_CLOEXEC
 #ifdef SOCK_CLOEXEC
+#define LINUX_CLOEXEC_OPEN_SOCKET
   type |= SOCK_CLOEXEC;
   type |= SOCK_CLOEXEC;
 #endif
 #endif
   s = socket(domain, type, protocol);
   s = socket(domain, type, protocol);
   if (s >= 0) {
   if (s >= 0) {
-#ifdef FD_CLOEXEC
+#if !defined(LINUX_CLOEXEC_OPEN_SOCKET) && defined(FD_CLOEXEC)
     fcntl(s, F_SETFD, FD_CLOEXEC);
     fcntl(s, F_SETFD, FD_CLOEXEC);
 #endif
 #endif
     socket_accounting_lock();
     socket_accounting_lock();