diff options
author | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-06-11 13:15:00 +0530 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-06-13 16:37:21 +0530 |
commit | a91359956f166005749247eaa5f4001a4555689d (patch) | |
tree | 8778a8cc0dcae9777b02ef7cf827c489db6b36c1 /src/pulsecore/authkey.c | |
parent | 59968f8e2cd90eb06c6d8b247811129cfe3980ea (diff) |
auth: Create cookie directory if it doesn't exist
Makes sure the cookie directory exists before trying to create the
cookie. This might be the case on freshly installed headless systems.
Diffstat (limited to 'src/pulsecore/authkey.c')
-rw-r--r-- | src/pulsecore/authkey.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c index c37d3fe5f..73e4f5e62 100644 --- a/src/pulsecore/authkey.c +++ b/src/pulsecore/authkey.c @@ -82,6 +82,9 @@ static int load(const char *fn, pa_bool_t create, void *data, size_t length) { pa_assert(data); pa_assert(length > 0); + if (create) + pa_make_secure_parent_dir(fn, pa_in_system_mode() ? 0755U : 0700U, -1, -1); + if ((fd = pa_open_cloexec(fn, (create ? O_RDWR|O_CREAT : O_RDONLY)|O_BINARY, S_IRUSR|S_IWUSR)) < 0) { if (!create || errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY)) < 0) { |