From faf20d4cca04cb9d08d098d4d9748e493648703b Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 14 Mar 2022 18:16:15 +0100 Subject: [PATCH] journal: reset previously set JSON flags Make sure we reset the JSON format flags if the format option is used multiple times, e.g. `journalctl -o json-format -o export`. Pointed out in: https://github.com/systemd/systemd/pull/22721#discussion_r826018985 Follow-up for: 5a1355d848a0f6564a04c6d8268e72bc93d173de --- src/journal/journalctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 4e3d17678e0..e0951f9682e 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -581,6 +581,9 @@ static int parse_argv(int argc, char *argv[]) { if (OUTPUT_MODE_IS_JSON(arg_output)) arg_json_format_flags = output_mode_to_json_format_flags(arg_output) | JSON_FORMAT_COLOR_AUTO; + else + arg_json_format_flags = JSON_FORMAT_OFF; + break; case 'l': -- 2.47.3