From 188afc58da17f77692e44839eccd260321c7955c Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Fri, 29 Apr 2022 14:46:09 +0200 Subject: [PATCH] Use 3 digits for rotated logfiles profanity.log.001 -> 999. --- src/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/log.c b/src/log.c index 296f20b5..191f8a84 100644 --- a/src/log.c +++ b/src/log.c @@ -237,9 +237,9 @@ _rotate_log_file(void) size_t len = strlen(log_file); gchar* log_file_new = malloc(len + 4); - // find an empty name. from .log -> log.01 -> log.99 - for (int i = 1; i < 100; i++) { - g_sprintf(log_file_new, "%s.%02d", log_file, i); + // find an empty name. from .log -> log.001 -> log.999 + for (int i = 1; i < 1000; i++) { + g_sprintf(log_file_new, "%s.%03d", log_file, i); if (!g_file_test(log_file_new, G_FILE_TEST_EXISTS)) break; }