From 46dcc0d269fe70df95cc452509d73cad59d284c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 6 Apr 2009 12:14:42 +0000 Subject: [PATCH] * enable the watcher do differenciate between crash & regular exit, so he can send the crash mail in the right cases only. --- citadel/citserver.c | 2 ++ citadel/server.h | 3 +++ citadel/sysdep.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index 94a5894f3..4e65fd6da 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -228,6 +228,8 @@ void master_cleanup(int exitcode) { if (restart_server != 0) exit(1); + if ((running_as_daemon != 0) && (exitcode == 0)) + exitcode = CTDLEXIT_SHUTDOWN; exit(exitcode); } diff --git a/citadel/server.h b/citadel/server.h index 577494ed5..f92402277 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -43,6 +43,9 @@ struct CtdlMessage { #define CTDLEXIT_OOD 104 /* Out Of Date config - rerun setup */ #define CTDLEXIT_DB 105 /* Unable to initialize database */ #define CTDLEXIT_LIBCITADEL 106 /* Incorrect version of libcitadel */ +#define CTDLEXIT_SHUTDOWN 150 /* we're going down. watcher don't + * fire us up again. + */ diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 46bdf021a..4cd22d0d5 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -964,7 +964,7 @@ void start_daemon(int unused) { if (WIFEXITED(status)) { /* Exit code 0 means the watcher should exit */ - if (WEXITSTATUS(status) == 0) { + if (WEXITSTATUS(status) == CTDLEXIT_SHUTDOWN) { do_restart = 0; } -- 2.30.2