mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 10:25:42 +08:00
Use set_cloexec instead of fcntl directly in iothread.cpp
This commit is contained in:
parent
216f7d912a
commit
7a76efa629
@ -14,6 +14,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "iothread.h"
|
||||
#include "wutil.h"
|
||||
|
||||
#ifdef _POSIX_THREAD_THREADS_MAX
|
||||
#if _POSIX_THREAD_THREADS_MAX < 64
|
||||
@ -94,10 +95,8 @@ static void iothread_init(void) {
|
||||
s_read_pipe = pipes[0];
|
||||
s_write_pipe = pipes[1];
|
||||
|
||||
// 0 means success to VOMIT_ON_FAILURE. Arrange to pass 0 if fcntl returns anything other
|
||||
// than -1.
|
||||
VOMIT_ON_FAILURE(-1 == fcntl(s_read_pipe, F_SETFD, FD_CLOEXEC));
|
||||
VOMIT_ON_FAILURE(-1 == fcntl(s_write_pipe, F_SETFD, FD_CLOEXEC));
|
||||
set_cloexec(s_read_pipe);
|
||||
set_cloexec(s_write_pipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user