[pulseaudio-commits] r2193 - in /branches/prepare-0.9.10/src/daemon: caps.c caps.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Mar 29 17:39:57 PDT 2008


Author: lennart
Date: Sun Mar 30 01:39:57 2008
New Revision: 2193

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2193&root=pulseaudio&view=rev
Log:
make pa_drop_caps() abort on failure

Modified:
    branches/prepare-0.9.10/src/daemon/caps.c
    branches/prepare-0.9.10/src/daemon/caps.h

Modified: branches/prepare-0.9.10/src/daemon/caps.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/daemon/caps.c?rev=2193&root=pulseaudio&r1=2192&r2=2193&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/daemon/caps.c (original)
+++ branches/prepare-0.9.10/src/daemon/caps.c Sun Mar 30 01:39:57 2008
@@ -90,8 +90,8 @@
     cap_t caps;
     cap_value_t nice_cap = CAP_SYS_NICE;
 
-    caps = cap_init();
-    pa_assert(caps);
+    pa_assert_se(caps = cap_init());
+
     cap_clear(caps);
     cap_set_flag(caps, CAP_EFFECTIVE, 1, &nice_cap, CAP_SET);
     cap_set_flag(caps, CAP_PERMITTED, 1, &nice_cap, CAP_SET);
@@ -113,28 +113,15 @@
 }
 
 /* Drop all capabilities, effectively becoming a normal user */
-int pa_drop_caps(void) {
+void pa_drop_caps(void) {
     cap_t caps;
-    int r = -1;
 
-    caps = cap_init();
-    pa_assert(caps);
+    pa_assert_se(prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) == 0);
 
+    pa_assert_se(caps = cap_init());
     cap_clear(caps);
-
-    prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0);
-
-    if (cap_set_proc(caps) < 0) {
-        pa_log("Failed to drop capabilities: %s", pa_cstrerror(errno));
-        goto fail;
-    }
-
-    r = 0;
-
-fail:
+    pa_assert_se(cap_set_proc(caps) == 0);
     cap_free(caps);
-
-    return r;
 }
 
 #else

Modified: branches/prepare-0.9.10/src/daemon/caps.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/daemon/caps.h?rev=2193&root=pulseaudio&r1=2192&r2=2193&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/daemon/caps.h (original)
+++ branches/prepare-0.9.10/src/daemon/caps.h Sun Mar 30 01:39:57 2008
@@ -25,7 +25,7 @@
 ***/
 
 void pa_drop_root(void);
+void pa_drop_caps(void);
 int pa_limit_caps(void);
-int pa_drop_caps(void);
 
 #endif




More information about the pulseaudio-commits mailing list