Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
linux: omit superfluous fcntl(F_GETFD) syscall
  • Loading branch information
bnoordhuis committed Oct 29, 2011
1 parent c0792e5 commit 84bc186
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/unix/core.c
Expand Up @@ -763,6 +763,12 @@ int uv__nonblock(int fd, int set) {


int uv__cloexec(int fd, int set) {
#if __linux__
/* Linux knows only FD_CLOEXEC so we can safely omit the fcntl(F_GETFD)
* syscall. CHECKME: That's probably true for other Unices as well.
*/
return fcntl(fd, F_SETFD, set ? FD_CLOEXEC : 0);
#else
int flags;

if ((flags = fcntl(fd, F_GETFD)) == -1) {
Expand All @@ -780,6 +786,7 @@ int uv__cloexec(int fd, int set) {
}

return 0;
#endif
}


Expand Down

0 comments on commit 84bc186

Please sign in to comment.