Compare commits

...

2 Commits

Author SHA1 Message Date
Daan De Meyer 0ae8ccad5b
Merge 44d1ad6d4f into f755ac99cb 2024-11-06 10:25:05 +01: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 "audit-util.h"
#include "cgroup-util.h"
#include "chattr-util.h"
#include "conf-parser.h"
#include "creds-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 (s->storage == STORAGE_PERSISTENT)
(void) mkdir_parents(s->system_storage.path, 0755);
if (s->storage == STORAGE_PERSISTENT) {
_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);