more diags
authorArt Cancro <ajc@citadel.org>
Wed, 8 Aug 2018 15:11:55 +0000 (11:11 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Aug 2018 15:11:55 +0000 (11:11 -0400)
citadel/control.c
citadel/server_main.c

index 1184be4a592673365ec68f2c3862ffe356026af7..cf587a0443c9e89bd273a22348fbbc04a7de3a41 100644 (file)
@@ -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();
        }
index 8df0f343a249fd01525e917530ddd2530d1f1569..3e94a8ab124fa6e66d38fb3f37bd58434f1105c9 100644 (file)
@@ -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: