]> code.delx.au - pulseaudio/commitdiff
Make -1 mean "current group/user" so that some platform dependent calls
authorPierre Ossman <ossman@cendio.se>
Thu, 20 Jul 2006 00:21:50 +0000 (00:21 +0000)
committerPierre Ossman <ossman@cendio.se>
Thu, 20 Jul 2006 00:21:50 +0000 (00:21 +0000)
can be centralised.

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1113 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/daemon/main.c
src/modules/module-protocol-stub.c
src/pulse/context.c
src/pulsecore/core-util.c

index cf655ee0b7c41ce1532f4bcb9e6a16cba213acd5..948b20551e806c16fb6a58953d891ed1e6b14504 100644 (file)
@@ -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;
     }
index ecbc5676ce488bd86cc28a5b1c12ccf4627d80a0..36d7db8959d5d452798f160ca9966b17e96292be 100644 (file)
@@ -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;
     }
index efc1685bfc3a7fd9681198d7c02562f7fe88e243..30a257fe6be75248b28af63d2358a7925f971940 100644 (file)
@@ -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);
 
index 0e6501b8f3a95a35f09d520508377596d4f74588..595ef939fb33eac619c01b00f7734bea6c6c2f2d 100644 (file)
@@ -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