AmendHub

Download:

jcs

/

subtext

/

amendments

/

505

board: Delete cached index if id_map fails allocation


jcs made amendment 505 about 1 year ago
--- board.c Wed Apr 19 00:04:08 2023 +++ board.c Mon May 1 07:30:29 2023 @@ -1652,7 +1652,7 @@ board_index_sorted_post_ids(struct board *board, } write_out: - if (npost_ids == 0) { + if (npost_ids == 0 || id_map == NULL) { board_delete_cached_index(board); if (sorted_id_map != NULL) *sorted_id_map = NULL; @@ -1892,7 +1892,8 @@ done: if (deleted) { board_index_sorted_post_ids(board, NULL); - logger_printf("[board] Pruned %lu posts in %s older than %d days", - deleted, board->name, board->retention_days); + logger_printf("[board] Pruned %lu post%s in %s older than %d day%s", + deleted, deleted == 1 ? "" : "s", board->name, + board->retention_days, board->retention_days == 1 ? "" : "s"); } }