summaryrefslogtreecommitdiff
path: root/libbb/vfork_daemon_rexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/vfork_daemon_rexec.c')
-rw-r--r--libbb/vfork_daemon_rexec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 81ae126..26d1826 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -35,8 +35,8 @@ void vfork_daemon_rexec(int nochdir, int noclose,
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
- if (fd > 2)
- close(fd);
+ while (fd > 2)
+ close(fd--);
}
vfork_args = xzalloc(sizeof(char *) * (argc + 3));