]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-upload: make --namespace=* work
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 5 Jul 2023 00:19:16 +0000 (09:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 5 Jul 2023 00:21:24 +0000 (09:21 +0900)
Follow-up for 9f6e0bd417fa287dd1e7b541bfe0c60f04cc29e4.

Note that sd_journal_open() is a simple wrapper of sd_journal_open_namespace(),
hence we can merge the two branch.

src/journal-remote/journal-upload.c

index 22f318f314bb5573f7e618a116d3f9b8a7a74e8a..404312b4d3989b0583735edf1a655147befb5347 100644 (file)
@@ -779,11 +779,9 @@ static int open_journal(sd_journal **j) {
                 /* FIXME: replace with D-Bus call OpenMachineRootDirectory() so that things also work with raw disk images */
                 r = sd_journal_open_container(j, arg_machine, 0);
 #pragma GCC diagnostic pop
-        } else if (arg_namespace)
-                r = sd_journal_open_namespace(j, arg_namespace, (arg_merge ? 0 : SD_JOURNAL_LOCAL_ONLY) |
-                                              arg_namespace_flags | arg_journal_type);
-        else
-                r = sd_journal_open(j, (arg_merge ? 0 : SD_JOURNAL_LOCAL_ONLY) | arg_journal_type);
+        } else
+                r = sd_journal_open_namespace(j, arg_namespace,
+                                              (arg_merge ? 0 : SD_JOURNAL_LOCAL_ONLY) | arg_namespace_flags | arg_journal_type);
         if (r < 0)
                 log_error_errno(r, "Failed to open %s: %m",
                                 arg_directory ?: (arg_file ? "files" : "journal"));