2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: fix cache write message when stdin is used

Using stdin with --write-cache set results in

  # apparmor_parser --show-cache --write-cache
  Cache: added primary location '/var/cache/apparmor'
  Warnung aus stdin (Zeile 1): Cache: added readonly location '/usr/share/apparmor/cache'
  Warnung aus stdin (Zeile 1): apparmor_parser: cannot use or update cache, disable, or force-complain via stdin
  Cache miss: stdin
  Wrote cache: /var/cache/apparmor/9b2cd0d0.0/(null)

The "Wrote cache:" message is referencing a null value and should not
be displayed.

BugLink: http://bugs.launchpad.net/bugs/1787717
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Timeout
This commit is contained in:
John Johansen
2018-08-19 02:44:36 -07:00
parent f651633281
commit e45a46d47d

View File

@@ -917,6 +917,7 @@ int process_profile(int option, aa_kernel_interface *kernel_interface,
}
} else {
pwarn("%s: cannot use or update cache, disable, or force-complain via stdin\n", progname);
skip_cache = write_cache = 0;
}
reset_parser(profilename);
@@ -1306,7 +1307,6 @@ int main(int argc, char *argv[])
if (create_cache_dir)
pwarn(_("The --create-cache-dir option is deprecated. Please use --write-cache.\n"));
retval = aa_policy_cache_new(&policy_cache, kernel_features,
AT_FDCWD, cacheloc[0], max_caches);
if (retval) {