2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00

parser: Deprecate the --create-cache-dir option

This option adds unneeded complexity to the parser CLI and the upcoming
aa_policy_cache API. Get rid of it and simply create the cache dir if
--write-cache is specified.

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 5b85282e9f
commit d93d00cca9
2 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,7 @@ int skip_read_cache = 0;
int write_cache = 0; int write_cache = 0;
int cond_clear_cache = 1; /* only applies if write is set */ int cond_clear_cache = 1; /* only applies if write is set */
int force_clear_cache = 0; /* force clearing regargless of state */ int force_clear_cache = 0; /* force clearing regargless of state */
int create_cache_dir = 0; /* create the cache dir if missing? */ int create_cache_dir = 0; /* DEPRECATED in favor of write_cache */
int preprocess_only = 0; int preprocess_only = 0;
int skip_mode_force = 0; int skip_mode_force = 0;
int abort_on_error = 0; /* stop processing profiles if error */ int abort_on_error = 0; /* stop processing profiles if error */
@ -165,7 +165,6 @@ static void display_usage(const char *command)
"-W, --write-cache Save cached profile (force with -T)\n" "-W, --write-cache Save cached profile (force with -T)\n"
" --skip-bad-cache Don't clear cache if out of sync\n" " --skip-bad-cache Don't clear cache if out of sync\n"
" --purge-cache Clear cache regardless of its state\n" " --purge-cache Clear cache regardless of its state\n"
" --create-cache-dir Create the cache dir if missing\n"
" --debug-cache Debug cache file checks\n" " --debug-cache Debug cache file checks\n"
"-L, --cache-loc n Set the location of the profile cache\n" "-L, --cache-loc n Set the location of the profile cache\n"
"-q, --quiet Don't emit warnings\n" "-q, --quiet Don't emit warnings\n"
@ -923,6 +922,9 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if (create_cache_dir)
pwarn(_("The --create-cache-dir option is deprecated. Please use --write-cache.\n"));
retval = setup_cache(features, cacheloc); retval = setup_cache(features, cacheloc);
if (retval) { if (retval) {
PERROR(_("Failed setting up policy cache (%s): %s\n"), PERROR(_("Failed setting up policy cache (%s): %s\n"),

View File

@ -123,7 +123,7 @@ create_file:
error: error:
/* does the dir exist? */ /* does the dir exist? */
if (stat(cachedir, &stat_file) == -1 && create_cache_dir) { if (stat(cachedir, &stat_file) == -1) {
if (mkdir(cachedir, 0700) == 0) if (mkdir(cachedir, 0700) == 0)
goto create_file; goto create_file;
if (show_cache) if (show_cache)