parser: Lift force_clear_cache handling from setup_cache()

This keeps us from having to use the force_clear_cache global in
policy_cache.c.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Tyler Hicks 2015-03-25 17:09:26 -05:00
parent d2e3f806c0
commit 22993081c8
2 changed files with 10 additions and 3 deletions

View file

@ -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"),

View file

@ -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.