aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 3f4819fb..09264c95 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -570,7 +570,7 @@ void loopfiles_rw(char **argv, int flags, int permissions, int failok,
continue;
}
function(fd, *argv);
- if (flags & O_CLOEXEC) close(fd);
+ if ((flags & O_CLOEXEC) && fd) close(fd);
} while (*++argv);
}