]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: log removal of runtime journal directories
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 May 2024 21:01:34 +0000 (06:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 25 May 2024 18:11:24 +0000 (03:11 +0900)
src/journal/journald-server.c

index 514ed09566df7961f09b3d4435a677e556710319..4f8cff29d4ef98ae1775f9d765942848c054ec93 100644 (file)
@@ -1411,7 +1411,11 @@ finish:
 
         /* Remove the runtime directory if the all entries are successfully flushed to /var/. */
         if (r >= 0) {
-                (void) rm_rf(s->runtime_storage.path, REMOVE_ROOT);
+                r = rm_rf(s->runtime_storage.path, REMOVE_ROOT);
+                if (r < 0)
+                        log_debug_errno(r, "Failed to remove runtime journal directory %s, ignoring: %m", s->runtime_storage.path);
+                else
+                        log_debug("Removed runtime journal directory %s.", s->runtime_storage.path);
 
                 /* The initrd may have a different machine ID from the host's one. Typically, that happens
                  * when our tests running on qemu, as the host's initrd is picked as is without updating
@@ -1419,8 +1423,13 @@ finish:
                  * runtime journals in the subdirectory named with the initrd's machine ID are flushed to
                  * the persistent journal. To make not the runtime journal flushed multiple times, let's
                  * also remove the runtime directories. */
-                STRV_FOREACH(p, dirs)
-                        (void) rm_rf(*p, REMOVE_ROOT);
+                STRV_FOREACH(p, dirs) {
+                        r = rm_rf(*p, REMOVE_ROOT);
+                        if (r < 0)
+                                log_debug_errno(r, "Failed to remove additional runtime journal directory %s, ignoring: %m", *p);
+                        else
+                                log_debug("Removed additional runtime journal directory %s.", *p);
+                }
         }
 
         server_driver_message(s, 0, NULL,