Pārlūkot izejas kodu

Don't both open the socket with SOCK_CLOEXEC and set FD_CLOEXEC

Steven Murdoch 15 gadi atpakaļ
vecāks
revīzija
15f2b7859b
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  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;
 #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();