Prevent infinite test loop.

This commit is contained in:
Dianne Skoll
2025-01-21 11:48:56 -05:00
parent 901831ff75
commit 35c33ae915
2 changed files with 9 additions and 0 deletions

View File

@@ -1125,6 +1125,12 @@ ProcessLongOption(char const *arg)
if (!strcmp(arg, "test")) {
fprintf(stderr, "Enabling test mode: This is meant for the acceptance test.\nDo not use --test in production.\n");
TestMode = 1;
/* Update RealToday because of TestMode */
RealToday = SystemDate(&CurYear, &CurMon, &CurDay);
DSEToday = RealToday;
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
return;
}
if (!strcmp(arg, "version")) {

View File

@@ -1050,6 +1050,9 @@ int SystemDate(int *y, int *m, int *d)
/* In test mode, always return 6 January 2025 */
if (TestMode) {
*y = 2025;
*m = 0;
*d = 6;
return 12803; /* 2025-01-06 */
}