about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-04-29 14:46:09 +0200
committerMichael Vetter <jubalh@iodoru.org>2022-04-29 15:40:56 +0200
commit188afc58da17f77692e44839eccd260321c7955c (patch)
tree15ef79452cca6736216dbb168ec3f326f5a7f50c /src
parentc4d7f1c29a2b3bfed93fc322e77263c0cd3e371a (diff)
downloadprofani-tty-188afc58da17f77692e44839eccd260321c7955c.tar.gz
Use 3 digits for rotated logfiles
profanity.log.001 -> 999.
Diffstat (limited to 'src')
-rw-r--r--src/log.c6
1 files 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;
     }