diff --git a/src/unix/core.c b/src/unix/core.c index 459e3c91..c47f0d95 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -651,21 +651,9 @@ int uv__cloexec_fcntl(int fd, int set) { int flags; int r; - do - r = fcntl(fd, F_GETFD); - while (r == -1 && errno == EINTR); - - if (r == -1) - return UV__ERR(errno); - - /* Bail out now if already set/clear. */ - if (!!(r & FD_CLOEXEC) == !!set) - return 0; - + flags = 0; if (set) - flags = r | FD_CLOEXEC; - else - flags = r & ~FD_CLOEXEC; + flags = FD_CLOEXEC; do r = fcntl(fd, F_SETFD, flags);