summaryrefslogtreecommitdiff
path: root/src/libstddjb/uncoe.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-23 12:36:34 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-23 12:36:34 +0000
commit265092c55d40f362a521eee97676e0d51ef17800 (patch)
treed3c8bab7499368b9181b682d3ab681fba265aea2 /src/libstddjb/uncoe.c
parentcc31550d01415181e70150ad3e9043d049b07a09 (diff)
downloadskalibs-265092c55d40f362a521eee97676e0d51ef17800.tar.xz
Save syscalls on coe and ndelay_on
Diffstat (limited to 'src/libstddjb/uncoe.c')
-rw-r--r--src/libstddjb/uncoe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstddjb/uncoe.c b/src/libstddjb/uncoe.c
index b6bf430..be7b90c 100644
--- a/src/libstddjb/uncoe.c
+++ b/src/libstddjb/uncoe.c
@@ -6,6 +6,5 @@
int uncoe (int fd)
{
int flags = fcntl(fd, F_GETFD, 0) ;
- if (flags < 0) return -1 ;
- return fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) ;
+ return flags < 0 ? flags : flags & FD_CLOEXEC ? fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) : 0 ;
}