summaryrefslogtreecommitdiff
path: root/src/libstddjb/coe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/coe.c')
-rw-r--r--src/libstddjb/coe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstddjb/coe.c b/src/libstddjb/coe.c
index 9f9f184..a32c4ef 100644
--- a/src/libstddjb/coe.c
+++ b/src/libstddjb/coe.c
@@ -6,6 +6,5 @@
int coe (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 ? 0 : fcntl(fd, F_SETFD, flags | FD_CLOEXEC) ;
}