1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Use 3 digits for rotated logfiles

profanity.log.001 -> 999.
This commit is contained in:
Michael Vetter 2022-04-29 14:46:09 +02:00
parent c4d7f1c29a
commit 188afc58da

View File

@ -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;
}