AmendHub

Download:

jcs

/

subtext

/

amendments

/

576

main: If the system clock has a date < 2024, don't run periodic jobs

Otherwise the date calculations will be wrong, the unsigned
comparisons will go negative and result in basically everything
getting pruned :(

jcs made amendment 576 3 months ago
--- main.c Thu Nov 30 14:40:03 2023 +++ main.c Tue Jan 10 10:50:01 2023 @@ -427,6 +427,13 @@ periodic_jobs(struct uthread *uthread, void *arg) if (nsessions != 0) goto sleep; + if (date_tm->tm_year + 1900 < 2024) { + logger_printf("[db] Bogus system clock (year %d), not " + "pruning", date_tm->tm_year + 1900); + last_daily_job = date_tm->tm_mday; + goto sleep; + } + if (db->config.session_log_prune_days) { session_prune_logs(db->config.session_log_prune_days); uthread_yield();