journald: don't try to rotate user journals in /var/log/journal/ if we are still...
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Nov 2018 16:48:22 +0000 (17:48 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Nov 2018 02:09:15 +0000 (11:09 +0900)
Fixes: #10879

src/journal/journald-server.c

index 9a5e7f615f3fbb4432d1e63e584be2cb720b306b..f7df39bd23196a50252990d1be8d62be00529802 100644 (file)
@@ -550,9 +550,11 @@ void server_rotate(Server *s) {
                         ordered_hashmap_remove(s->user_journals, k);
         }
 
-        /* Finally, also rotate all user journals we currently do not have open. */
-        r = open_user_journal_directory(s, &d, &path);
-        if (r >= 0) {
+        /* Finally, also rotate all user journals we currently do not have open. (But do so only if we actually have
+         * access to /var, i.e. are not in the log-to-runtime-journal mode). */
+        if (!s->runtime_journal &&
+            open_user_journal_directory(s, &d, &path) >= 0) {
+
                 struct dirent *de;
 
                 FOREACH_DIRENT(de, d, log_warning_errno(errno, "Failed to enumerate %s, ignoring: %m", path)) {