/*
* 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)
{
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();
}
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));
}
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: