소스 검색

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
Steven Murdoch 15 년 전
부모
커밋
a961521a86
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/common/compat.c

+ 1 - 1
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)