]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: use an anonymous array when an array is needed
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Nov 2019 10:24:33 +0000 (11:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 31 Jan 2020 14:02:22 +0000 (15:02 +0100)
I am pretty sure this makes things more readable, since the expected
argument here is actually an array.

src/journal/journalctl.c

index 3ab79d11a510c5d817e254815ff4f31d9b554d4e..6a4498641336a8f7a874c7e20b32dd5a4613832e 100644 (file)
@@ -2104,10 +2104,9 @@ int main(int argc, char *argv[]) {
                 r = sd_journal_open_directory(&j, arg_directory, arg_journal_type);
         else if (arg_root)
                 r = sd_journal_open_directory(&j, arg_root, arg_journal_type | SD_JOURNAL_OS_ROOT);
-        else if (arg_file_stdin) {
-                int ifd = STDIN_FILENO;
-                r = sd_journal_open_files_fd(&j, &ifd, 1, 0);
-        } else if (arg_file)
+        else if (arg_file_stdin)
+                r = sd_journal_open_files_fd(&j, (int[]) { STDIN_FILENO }, 1, 0);
+        else if (arg_file)
                 r = sd_journal_open_files(&j, (const char**) arg_file, 0);
         else if (arg_machine) {
                 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;