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. --- 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); + r = mkdir(dir, m); + } umask(u); } #endif -- 1.7.8.6