From 05ab26fa32d364c71b582d5bb72b5305b2554ef6 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 8 Jan 2009 11:49:43 -0500 Subject: If exec() returns in start_service (for example, if the command contains a typo and therefore doesn't exist), we cannot call exit() due to a bug in D-BUS. We will replace this with _exit() and also print out the nature of the error that caused exec() to return. --- server/monitor.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/monitor.c b/server/monitor.c index bddc0d48..18fb3255 100644 --- a/server/monitor.c +++ b/server/monitor.c @@ -401,7 +401,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, if (svc->command == NULL) { /* the LOCAL domain does not need a backend at the moment */ if (strcasecmp(doms[i], "LOCAL") != 0) { - DEBUG(0, ("Missing command to run provider [%s]\n")); + DEBUG(0, ("Missing command to run provider\n")); } talloc_free(svc); continue; @@ -884,7 +884,15 @@ static int start_service(const char *name, const char *command, pid_t *retpid) args = parse_args(command); execvp(args[0], args); - exit(1); + + /* If we are here, exec() has failed + * Print errno and abort quickly */ + DEBUG(0,("Could not exec %s, reason: %s\n", command, strerror(errno))); + + /* We have to call _exit() instead of exit() here + * because a bug in D-BUS will cause the server to + * close its socket at exit() */ + _exit(1); } int main(int argc, const char *argv[]) -- cgit