diff options
Diffstat (limited to '')
-rw-r--r-- | src/fd_util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fd_util.c b/src/fd_util.c index b9443b03d..769823bc4 100644 --- a/src/fd_util.c +++ b/src/fd_util.c @@ -104,6 +104,16 @@ fd_set_nonblock(int fd) } int +dup_cloexec(int oldfd) +{ + int newfd = dup(oldfd); + if (newfd >= 0) + fd_set_nonblock(newfd); + + return newfd; +} + +int open_cloexec(const char *path_fs, int flags, int mode) { int fd; |