On Thu, Jun 19, 2008 at 06:45:27PM +0200, Ferenc Wagner wrote: > Okay, a looked into this. On a reinstall, this is the FD set of dpkg > and multipath-tools' postinst spawned by it directly: The attached patch makes sure leaked fds get closed properly. -- Guido
>From 7fa2dbd516993b6d64a9a1ca244d03f303db4862 Mon Sep 17 00:00:00 2001 From: Guido Guenther <[EMAIL PROTECTED]> Date: Tue, 24 Jun 2008 17:05:39 +0200 Subject: [PATCH] [multipathd] close all file descriptors
makes sure multipathd doesn't keep fds open needlesly. See http://bugs.debian.org/487682 for more details. --- multipathd/main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index da5fd8f..1917bbe 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1361,7 +1361,7 @@ child (void * param) static int daemonize(void) { - int pid; + int pid, i; int in_fd, out_fd; if( (pid = fork()) < 0){ @@ -1378,6 +1378,9 @@ daemonize(void) else if (pid != 0) _exit(0); + for (i = getdtablesize()-1; i > STDERR_FILENO; --i) + close(i); + in_fd = open("/dev/null", O_RDONLY); if (in_fd < 0){ fprintf(stderr, "cannot open /dev/null for input : %s\n", -- 1.5.5.4