aboutsummaryrefslogtreecommitdiffstats
path: root/src/fd_util.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fd_util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fd_util.c b/src/fd_util.c
index f2ec4fcb3..9c60d00ae 100644
--- a/src/fd_util.c
+++ b/src/fd_util.c
@@ -114,7 +114,8 @@ open_cloexec(const char *path_fs, int flags, int mode)
#endif
fd = open(path_fs, flags, mode);
- fd_set_cloexec(fd, true);
+ if (fd >= 0)
+ fd_set_cloexec(fd, true);
return fd;
}