diff options
author | Shawn Landden <shawnlandden@gmail.com> | 2013-07-12 20:57:15 -0700 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-07-13 07:56:11 -0400 |
commit | b98e3866fddf2edfa13fc1b4323aa84f89336ff2 (patch) | |
tree | 28ad52a4b97c3316cbd71b6353f77e1950d0c421 /src/journal | |
parent | 3d56f7df4411684404470d36ddec0d90649a13a3 (diff) |
journalctl: have a useful --setup-keys error message when using non-persistant logging
Generating seed...
Generating key pair...
Generating sealing key...
Failed to open /var/log/journal/33f46101703a10c5fc6fa4f451840101/fss.tmp.k2wDDU: No such file or directory
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journalctl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 7baea237cb..32665b7f78 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -725,6 +725,19 @@ static int setup_keys(void) { char *p = NULL, *k = NULL; struct FSSHeader h; uint64_t n; + struct stat st; + + r = stat("/var/log/journal", &st); + if (r < 0 && errno != ENOENT && errno != ENOTDIR) { + log_error("stat(\"%s\") failed: %m", "/var/log/journal"); + return -errno; + } + + if (r < 0 || !S_ISDIR(st.st_mode)) { + log_error("%s is not a directory, must be using persistent logging for FSS.", + "/var/log/journal"); + return r < 0 ? -errno : -ENOTDIR; + } r = sd_id128_get_machine(&machine); if (r < 0) { |