This keeps us from having to use the force_clear_cache global in policy_cache.c.
Signed-off-by: Tyler Hicks <[email protected]> --- parser/parser_main.c | 10 ++++++++++ parser/policy_cache.c | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/parser/parser_main.c b/parser/parser_main.c index f1edd90..4af54a5 100644 --- a/parser/parser_main.c +++ b/parser/parser_main.c @@ -895,6 +895,16 @@ int main(int argc, char *argv[]) return 1; } + if (force_clear_cache) { + if (clear_cache_files(cacheloc)) { + PERROR(_("Failed to clear cache files (%s): %s\n"), + cacheloc, strerror(errno)); + return 1; + } + + return 0; + } + retval = setup_cache(cacheloc); if (retval) { PERROR(_("Failed setting up policy cache (%s): %s\n"), diff --git a/parser/policy_cache.c b/parser/policy_cache.c index e7c3c60..469d884 100644 --- a/parser/policy_cache.c +++ b/parser/policy_cache.c @@ -238,9 +238,6 @@ int setup_cache(const char *cacheloc) return -1; } - if (force_clear_cache) - exit(clear_cache_files(cacheloc)); - /* * Deal with cache directory versioning: * - If cache/.features is missing, create it if --write-cache. -- 2.1.0 -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
