From 7a76efa629eadd5a1e0cf257eecfaf833631b81c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 23 Jan 2017 09:59:56 -0800 Subject: [PATCH] Use set_cloexec instead of fcntl directly in iothread.cpp --- src/iothread.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/iothread.cpp b/src/iothread.cpp index 56ef5416b..bfc7f53d5 100644 --- a/src/iothread.cpp +++ b/src/iothread.cpp @@ -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); } }