openvt,getty,vfork_daemon_rexec,mount: tighten up fd cleanup code
[platform/upstream/busybox.git] / util-linux / mount.c
index b3e8c47..77382ff 100644 (file)
@@ -737,7 +737,7 @@ static int daemonize(void)
        dup2(fd, 0);
        dup2(fd, 1);
        dup2(fd, 2);
-       if (fd > 2) close(fd);
+       while (fd > 2) close(fd--);
        setsid();
        openlog(applet_name, LOG_PID, LOG_DAEMON);
        logmode = LOGMODE_SYSLOG;