Merge aa-status: append \n to --json and --pretty-json output

... so that - if someone calls aa-status from the commandline - the next prompt doesn't get displayed in the same line as the json output.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/541
Acked-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2020-05-21 19:48:14 +00:00
commit 1fccf0458f

View file

@ -534,7 +534,7 @@ static int detailed_output(FILE *json) {
free_processes(filtered, nfiltered);
}
if (json) {
fprintf(json, "%s}}", nprocesses > 0 ? "]" : "");
fprintf(json, "%s}}\n", nprocesses > 0 ? "]" : "");
}
exit:
@ -578,7 +578,7 @@ static int cmd_pretty_json(__unused const char *command) {
dfprintf(stderr, "Failed to print pretty json");
return AA_EXIT_INTERNAL_ERROR;
}
fprintf(stdout, "%s", pretty);
fprintf(stdout, "%s\n", pretty);
return AA_EXIT_ENABLED;
}