]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: reset previously set JSON flags
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Mar 2022 17:16:15 +0000 (18:16 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Mar 2022 17:28:19 +0000 (18:28 +0100)
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

index 4e3d17678e03015ba1de79b30493896043dd3adf..e0951f9682e1cf5dab81b955ebbe6536db3091e9 100644 (file)
@@ -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':