summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-29 10:09:21 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-29 10:12:41 -0400
commit0db809489fd88a320ae1023ffe36a9965e9a91b2 (patch)
treee5566cb9cbd3789b8257972d4f9e4cb7b7f35477 /src
parent76877b46b652fbfcf8618458556178717b815cd8 (diff)
journalctl: fix --update-catalog with not --root arg
grawity> `journalctl --update-catalog` from latest git prints: "Recursive mkdir .: Invalid argument" and "Failed to write : Invalid argument"
Diffstat (limited to 'src')
-rw-r--r--src/journal/journalctl.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 3ae6482e99..c96d68dd4c 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1032,11 +1032,16 @@ int main(int argc, char *argv[]) {
arg_action == ACTION_LIST_CATALOG ||
arg_action == ACTION_DUMP_CATALOG) {
- char _cleanup_free_ *database;
- database = strjoin(arg_root, "/", CATALOG_DATABASE, NULL);
- if (!database) {
- r = log_oom();
- goto finish;
+ const char* database = CATALOG_DATABASE;
+ char _cleanup_free_ *copy = NULL;
+ if (arg_root) {
+ copy = strjoin(arg_root, "/", CATALOG_DATABASE, NULL);
+ if (!database) {
+ r = log_oom();
+ goto finish;
+ }
+ path_kill_slashes(copy);
+ database = copy;
}
if (arg_action == ACTION_UPDATE_CATALOG) {