mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
aa-status: allow pretty printed json to go to somewhere other than stdout
Add basic enablement (but no option yet) to send pretty printed json to a specified file. Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
508f9184ea
commit
66279ea1c7
1 changed files with 3 additions and 3 deletions
|
@ -589,7 +589,7 @@ exit:
|
|||
*
|
||||
* Return: 0 on success, shell error on failure
|
||||
*/
|
||||
static int cmd_pretty_json()
|
||||
static int cmd_pretty_json(FILE *outf)
|
||||
{
|
||||
autofree char *buffer = NULL;
|
||||
autofree char *pretty = NULL;
|
||||
|
@ -620,7 +620,7 @@ static int cmd_pretty_json()
|
|||
dfprintf(stderr, "Failed to print pretty json");
|
||||
return AA_EXIT_INTERNAL_ERROR;
|
||||
}
|
||||
fprintf(stdout, "%s\n", pretty);
|
||||
fprintf(outf, "%s\n", pretty);
|
||||
|
||||
return AA_EXIT_ENABLED;
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ static char **parse_args(int argc, char **argv)
|
|||
exit(detailed_output(stdout, true));
|
||||
break;
|
||||
case ARG_PRETTY:
|
||||
exit(cmd_pretty_json());
|
||||
exit(cmd_pretty_json(stdout));
|
||||
break;
|
||||
default:
|
||||
dfprintf(stderr, "Error: Invalid command.\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue