summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/daemon/main.c2
-rw-r--r--src/modules/module-protocol-stub.c2
-rw-r--r--src/pulse/context.c2
-rw-r--r--src/pulsecore/core-util.c4
4 files changed, 7 insertions, 3 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c
index cf655ee0..948b2055 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -249,7 +249,7 @@ static int create_runtime_dir(void) {
* per-user mode. We create the runtime directory somewhere in
* /tmp/ with the current UID/GID */
- if (pa_make_secure_dir(fn, 0700, getuid(), getgid()) < 0) {
+ if (pa_make_secure_dir(fn, 0700, (uid_t)-1, (gid_t)-1) < 0) {
pa_log(__FILE__": Failed to create '%s': %s", fn, pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c
index ecbc5676..36d7db89 100644
--- a/src/modules/module-protocol-stub.c
+++ b/src/modules/module-protocol-stub.c
@@ -254,7 +254,7 @@ int pa__init(pa_core *c, pa_module*m) {
/* This socket doesn't reside in our own runtime dir but in
* /tmp/.esd/, hence we have to create the dir first */
- if (pa_make_secure_parent_dir(u->socket_path, c->is_system_instance ? 0755 : 0700, getuid(), getgid()) < 0) {
+ if (pa_make_secure_parent_dir(u->socket_path, c->is_system_instance ? 0755 : 0700, (uid_t)-1, (gid_t)-1) < 0) {
pa_log(__FILE__": Failed to create socket directory: %s\n", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/pulse/context.c b/src/pulse/context.c
index efc1685b..30a257fe 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -707,7 +707,7 @@ int pa_context_connect(
char lf[PATH_MAX];
pa_runtime_path(AUTOSPAWN_LOCK, lf, sizeof(lf));
- pa_make_secure_parent_dir(lf, 0700, getuid(), getgid());
+ pa_make_secure_parent_dir(lf, 0700, (uid_t)-1, (gid_t)-1);
assert(c->autospawn_lock_fd <= 0);
c->autospawn_lock_fd = pa_lock_lockfile(lf);
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 0e6501b8..595ef939 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -157,6 +157,10 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
return -1;
#ifdef HAVE_CHOWN
+ if (uid == (uid_t)-1)
+ uid = getuid();
+ if (gid == (gid_t)-1)
+ gid = getgid();
chown(dir, uid, gid);
#endif