[mod_cgi] fix pipe_cloexec() when no O_CLOEXEC
This commit is contained in:
parent
7f4e156e5f
commit
9173d9aa7d
|
@ -39,7 +39,12 @@
|
|||
#ifdef O_CLOEXEC
|
||||
#define pipe_cloexec(pipefd) pipe2((pipefd), O_CLOEXEC)
|
||||
#elif defined FD_CLOEXEC
|
||||
#define pipe_cloexec(pipefd) (0 == pipe(pipefd) ? fcntl(fd, F_SETFD, FD_CLOEXEC) : -1)
|
||||
#define pipe_cloexec(pipefd) \
|
||||
( 0 == pipe(pipefd) \
|
||||
&& 0 == fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) \
|
||||
&& 0 == fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) \
|
||||
? 0 \
|
||||
: -1)
|
||||
#else
|
||||
#define pipe_cloexec(pipefd) pipe(pipefd)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue