Skip to contentSkip to conversation

Do not fork daemon when dmeventd cannot be found.

PATCH New Milan Broz 2 participants 2 messages Jun 5, 2009

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 Do not fork daemon when dmeventd cannot be found.

Do not fork daemon when dmeventd cannot be found.

Otherwise it prints many errors about leaked pools.

(More elegant is properly release context, but this workaround is sufficient IMHO.)

---
 daemons/dmeventd/libdevmapper-event.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
daemons/dmeventd/libdevmapper-event.c +6 -0
index 2650cf0..dae76d3 100644
@@ -425,6 +425,12 @@ static int _start_daemon(struct dm_event_fifos *fifos)
 
       start_server:
 	/* server is not running */
+
+	if (stat(DMEVENTD_PATH, &statbuf)) {
+		log_error("Unable to find dmeventd.");
+		return_0;
+	}
+
 	pid = fork();
 
 	if (pid < 0)
#1 lore raw

PATCH 1/1 Do not fork daemon when dmeventd cannot be found.

Hi!

daemons/dmeventd/libdevmapper-event.c static int _start_daemon(struct dm_event_fifos *fifos) · line 432

Quoted 13 lines · Milan Broz
daemons/dmeventd/libdevmapper-event.c +5 -0
index 2650cf0..dae76d3 100644
@@ -425,6 +425,12 @@ static int _start_daemon(struct dm_event_fifos *fifos)
 
       start_server:
 	/* server is not running */
+
+	if (stat(DMEVENTD_PATH, &statbuf)) {
+		log_error("Unable to find dmeventd.");
+		return_0;
+	}

Although not exactly spectacular, I guess this is fine. Just one thing, there's an execvp later for DMEVENTD_PATH, so this may actually not be really a safe check (DMEVENTD_PATH -> "dmeventd" should work without this check, but will break with it).

Yours,
Petr.

Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation