close open file descriptors in daemonize
PATCH 1/1 close open file descriptors in daemonize
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
daemon/automount.c +5 -0
@@ -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 ) {