mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-03 15:55:46 +00:00
aa_status: separate out version info
Separate out the aa-status json version info out from being a magic element embedded in a string in the middle of the json emitter, and move it to an early location, along with a comment to edit it whenthe format changes. Signed-off-by: Steve Beattie <steve.beattie@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com> https://gitlab.com/apparmor/apparmor/-/merge_requests/517
This commit is contained in:
@@ -33,6 +33,9 @@
|
|||||||
#define AA_EXIT_NO_PERM 4
|
#define AA_EXIT_NO_PERM 4
|
||||||
#define AA_EXIT_INTERNAL_ERROR 42
|
#define AA_EXIT_INTERNAL_ERROR 42
|
||||||
|
|
||||||
|
/* NOTE: Increment this whenever the JSON format changes */
|
||||||
|
static const unsigned char aa_status_json_version[] = "2";
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
struct profile {
|
struct profile {
|
||||||
@@ -451,7 +454,7 @@ static int detailed_output(FILE *json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
printf("{\"version\": \"2\", \"profiles\": {");
|
fprintf(json, "{\"version\": \"%s\", \"profiles\": {", aa_status_json_version);
|
||||||
} else {
|
} else {
|
||||||
dprintf("%zd profiles are loaded.\n", nprofiles);
|
dprintf("%zd profiles are loaded.\n", nprofiles);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user