From 7395c7c662ad7e40a99aef8937e8f90d9e9a729a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 8 Aug 2018 11:11:55 -0400 Subject: [PATCH] more diags --- citadel/control.c | 7 ++++++- citadel/server_main.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/citadel/control.c b/citadel/control.c index 1184be4a5..cf587a044 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -42,6 +42,11 @@ struct legacy_ctrl_format { /* * Callback to get highest room number when rebuilding message base metadata + * + * sanity_diag_mode (can be set by -s flag at startup) may be: + * 0 = attempt to fix inconsistencies + * 1 = show inconsistencies but don't repair them, exit after complete + * 2 = show inconsistencies but don't repair them, continue execution */ void control_find_highest(struct ctdlroom *qrbuf, void *data) { @@ -146,7 +151,7 @@ void check_control(void) syslog(LOG_INFO, "control: sanity checking the recorded highest user number"); ForEachUser(control_find_user, NULL); syslog(LOG_INFO, "control: sanity checks complete"); - if (sanity_diag_mode) { + if (sanity_diag_mode == 1) { syslog(LOG_INFO, "control: sanity check diagnostic mode is active - exiting now"); abort(); } diff --git a/citadel/server_main.c b/citadel/server_main.c index 8df0f343a..3e94a8ab1 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -94,7 +94,7 @@ int main(int argc, char **argv) InitializeMasterTSD(); /* parse command-line arguments */ - while ((a=getopt(argc, argv, "l:dh:x:t:B:Dru:s")) != EOF) switch(a) { + while ((a=getopt(argc, argv, "l:dh:x:t:B:Dru:s:")) != EOF) switch(a) { case 'l': safestrncpy(facility, optarg, sizeof(facility)); @@ -155,9 +155,9 @@ int main(int argc, char **argv) } break; - /* -s tells the server to suppress fixing any discrepancies found during sanity checks, but exit after those checks complete */ + /* -s tells the server to behave differently during sanity checks */ case 's': - sanity_diag_mode = 1; + sanity_diag_mode = atoi(optarg); break; default: -- 2.30.2