On 2015-01-21 04:14:45, John Johansen wrote: > On 01/20/2015 06:38 AM, John Johansen wrote: > > On 12/05/2014 04:22 PM, Tyler Hicks wrote: > >> 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 <[email protected]> > > Acked-by: John Johansen <[email protected]> > > > The ack still stands but I think there is an alternative implementation that > is > cleaner. > > We could drop the int create_cache_dir and move the pwarn into the args > processing
I'll do that as a follow-on patch after we get this set all acked and
merged. That'll be an easy fix.
Tyler
>
> >> ---
> >> parser/parser_main.c | 6 ++++--
> >> parser/policy_cache.c | 2 +-
> >> 2 files changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/parser/parser_main.c b/parser/parser_main.c
> >> index 717062f..5b0e215 100644
> >> --- a/parser/parser_main.c
> >> +++ b/parser/parser_main.c
> >> @@ -71,7 +71,7 @@ int skip_read_cache = 0;
> >> int write_cache = 0;
> >> int cond_clear_cache = 1; /* only applies if write is set */
> >> 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 skip_mode_force = 0;
> >> 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"
> >> " --skip-bad-cache Don't clear cache if out of sync\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"
> >> "-L, --cache-loc n Set the location of the profile cache\n"
> >> "-q, --quiet Don't emit warnings\n"
> >> @@ -908,6 +907,9 @@ int main(int argc, char *argv[])
> >> return 0;
> >> }
> >>
> >> + if (create_cache_dir)
> >> + pwarn(_("The --create-cache-dir option is deprecated. Please
> >> use --write-cache.\n"));
> >> +
> >> retval = setup_cache(features, 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 dea7e21..6c8d5ca 100644
> >> --- a/parser/policy_cache.c
> >> +++ b/parser/policy_cache.c
> >> @@ -123,7 +123,7 @@ create_file:
> >>
> >> error:
> >> /* does the dir exist? */
> >> - if (stat(cachedir, &stat_file) == -1 && create_cache_dir) {
> >> + if (stat(cachedir, &stat_file) == -1) {
> >> if (mkdir(cachedir, 0700) == 0)
> >> goto create_file;
> >> if (show_cache)
> >>
> >
> >
>
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
