On Mon, 2012-06-11 at 10:00 +0200, David Henningsson wrote: > On 06/11/2012 09:48 AM, Arun Raghavan wrote: > > This makes pa_make_secure_dir() create any missing parent directories in > > the given path as well. This is useful, for example, on a pristine > > system with a clean $HOME that needs ~/.config/pulse/ to be created when > > ~/.config does not exist. > > Hum, is moving from ~/.pulse to ~/.config/pulse something we've done > post 2.0? Or is this patch to make it easier for special configurations? This is something that's been done post 2.0. > > --- > > src/pulsecore/core-util.c | 6 ++++++ > > 1 files changed, 6 insertions(+), 0 deletions(-) > > > > diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c > > index 82480c6..5270979 100644 > > --- a/src/pulsecore/core-util.c > > +++ b/src/pulsecore/core-util.c > > @@ -230,6 +230,12 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) { > > mode_t u; > > u = umask((~m)& 0777); > > r = mkdir(dir, m); > > + if (r< 0&& errno == ENOENT) { > > + /* If a parent directory in the path doesn't exist, try to create that > > + * first, then try again. */ > > + pa_make_secure_parent_dir(dir, m, uid, gid); > > Hm, is there a possibility to get infinite recursion by specifying > strange paths such as ./ and ../ here? There should not be -- each step removes a path component, so it should always end in a finite number of steps. > > > + r = mkdir(dir, m); > > + } > > umask(u); > > } > > #endif > Thanks for the review, Arun