From: Yu Watanabe Date: Fri, 24 May 2024 21:01:34 +0000 (+0900) Subject: journald: log removal of runtime journal directories X-Git-Tag: v256-rc4~118^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=349fa06134c27c74f372122a0457e5f852306300;p=thirdparty%2Fsystemd.git journald: log removal of runtime journal directories --- diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 514ed09566d..4f8cff29d4e 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -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,