Compare commits

...

2 Commits

Author SHA1 Message Date
Daan De Meyer 5417a7439e
Merge 44d1ad6d4f into c946b13575 2024-11-22 13:52:07 -08:00
Daan De Meyer 44d1ad6d4f journal: Set +C if we create /var/log/journal
systemd-journal-flush.service runs before systemd-tmpfiles-setup.service
so we can't rely on tmpfiles setting +C for us, so let's make journald
set it itself if it creates /var/log/journal itself.
2024-04-30 12:07:16 +02:00
1 changed files with 13 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "audit-util.h" #include "audit-util.h"
#include "cgroup-util.h" #include "cgroup-util.h"
#include "chattr-util.h"
#include "conf-parser.h" #include "conf-parser.h"
#include "creds-util.h" #include "creds-util.h"
#include "dirent-util.h" #include "dirent-util.h"
@ -366,8 +367,18 @@ static int server_system_journal_open(
* *
* If in persistent mode: create /var/log/journal and the machine path */ * If in persistent mode: create /var/log/journal and the machine path */
if (s->storage == STORAGE_PERSISTENT) if (s->storage == STORAGE_PERSISTENT) {
(void) mkdir_parents(s->system_storage.path, 0755); _cleanup_free_ char *parent = NULL;
r = path_extract_directory(s->system_storage.path, &parent);
if (r < 0)
log_warning_errno(r, "Failed to extract parent directory from %s, ignoring: %m",
s->system_storage.path);
else {
(void) mkdir_p(parent, 0755);
(void) chattr_path(parent, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
}
}
(void) mkdir(s->system_storage.path, 0755); (void) mkdir(s->system_storage.path, 0755);