mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
varlinkctl: do not clobber format flags in verb_call
Currently, when SD_JSON_FORMAT_OFF is set in verb_call, the json format flags are set to SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO, rather than or'ing those flags in. This means that other flags that may have been set, e.g. SD_JSON_FORMAT_SEQ when --more is set, will be clobbered. Fix this by masking SD_JSON_FORMAT_OFF out, and then or'ing the new flags in.
This commit is contained in:
parent
119252343e
commit
c89b578f33
@ -539,8 +539,10 @@ static int verb_call(int argc, char *argv[], void *userdata) {
|
||||
parameter = argc > 3 && !streq(argv[3], "-") ? argv[3] : NULL;
|
||||
|
||||
/* No JSON mode explicitly configured? Then default to the same as -j */
|
||||
if (FLAGS_SET(arg_json_format_flags, SD_JSON_FORMAT_OFF))
|
||||
arg_json_format_flags = SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO;
|
||||
if (FLAGS_SET(arg_json_format_flags, SD_JSON_FORMAT_OFF)) {
|
||||
arg_json_format_flags &= ~SD_JSON_FORMAT_OFF;
|
||||
arg_json_format_flags |= SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO;
|
||||
}
|
||||
|
||||
/* For pipeable text tools it's kinda customary to finish output off in a newline character, and not
|
||||
* leave incomplete lines hanging around. */
|
||||
|
Loading…
Reference in New Issue
Block a user