aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/utils.c b/src/utils.c
index b070be2..a0d2f64 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -189,8 +189,6 @@ int close_fds_except(int fds, ...)
max_fd = sysconf(_SC_OPEN_MAX) - 1;
if (max_fd <= 0)
return 1;
- if (fds < 0)
- return 1;
va_start(ap, fds);
{
@@ -206,7 +204,7 @@ int close_fds_except(int fds, ...)
for (fd = max_fd; fd >= 0; --fd) {
found = 0;
- for (i = 0; i < except_count; ++i) {
+ for (i = 0; i < except_count && fds >= 0; ++i) {
if (fd == all_fds[i])
found++;
}