From: Wilfried Göesgens Date: Mon, 6 Apr 2009 12:14:42 +0000 (+0000) Subject: * enable the watcher do differenciate between crash & regular exit, so he can send... X-Git-Tag: v7.86~1309 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=46dcc0d269fe70df95cc452509d73cad59d284c6 * enable the watcher do differenciate between crash & regular exit, so he can send the crash mail in the right cases only. --- 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; }