Our daemonize function should really close open file descriptors that
were leaked to us.  This actually did result in a bug, whereby an "rpm
-Uvh" from an ssh session would leave the user unable to logout.

It's a pretty simple patch.  Comments welcome.

-Jeff

diff --git a/daemon/automount.c b/daemon/automount.c
index 3c42c8a..c09eaf6 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1436,10 +1436,15 @@ static void become_daemon(void)
        pid_t pid;
        int nullfd;
        int pfds[2];
+       int i;
 
        /* Don't BUSY any directories unnecessarily */
        chdir("/");
 
+       /* close open file descriptors, stdin/out/err are handled below */
+       for (i = 3; i < 255; i++)
+               close(i);
+
        /* Detach from foreground process */
        if (!submount) {
                if (pipe(pfds) < 0) {

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to