[PATCH] [multipathd] close all file descriptors
Guido Guenther
agx at sigxcpu.org
Tue Jun 24 15:05:39 UTC 2008
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
--PEIAKu/WMn1b1Hv9--
More information about the pkg-lvm-maintainers
mailing list