[apparmor] [PATCH v2 15/42] parser: Lift force_clear_cache handling from setup_cache()
Tyler Hicks
tyhicks at canonical.com
Fri Mar 6 21:48:31 UTC 2015
This keeps us from having to use the force_clear_cache global in
policy_cache.c.
Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: John Johansen <john.johansen at canonical.com>
---
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 8e68f5b..2455103 100644
--- a/parser/parser_main.c
+++ b/parser/parser_main.c
@@ -914,6 +914,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.4
More information about the AppArmor
mailing list