[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[dm-devel] [PATCH] Close file descriptors if forking returns an error.
- From: Konrad Rzeszutek <konrad virtualiron com>
- To: dm-devel redhat com
- Cc:
- Subject: [dm-devel] [PATCH] Close file descriptors if forking returns an error.
- Date: Thu, 8 Jan 2009 14:25:04 -0500
From: Konrad Rzeszutek <konrad mars virtualiron com>
And also use vfork instead of fork so that the heap space count
of the parent process (multipathd) will not be counted against
the program which will executed (scsi_id or other).
---
libmultipath/callout.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libmultipath/callout.c b/libmultipath/callout.c
index 4dd33c5..6f9d195 100644
--- a/libmultipath/callout.c
+++ b/libmultipath/callout.c
@@ -68,7 +68,7 @@ int execute_program(char *path, char *value, int len)
return -1;
- pid = fork();
+ pid = vfork();
switch(pid) {
case 0:
@@ -91,6 +91,9 @@ int execute_program(char *path, char *value, int len)
exit(-1);
case -1:
+ close(fds[0]);
+ close(fds[1]);
+ condlog(0, "error forking: %s. errno:%d\n", path, errno);
return -1;
default:
/* parent reads from fds[0] */
--
1.5.4.1
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]