[pulseaudio-commits] r2208 - in /trunk/src/daemon: caps.c caps.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Mar 31 15:12:33 PDT 2008


Author: lennart
Date: Tue Apr  1 00:12:32 2008
New Revision: 2208

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2208&root=pulseaudio&view=rev
Log:
merge r2193 from prepare-0.9.10

Modified:
    trunk/src/daemon/caps.c
    trunk/src/daemon/caps.h

Modified: trunk/src/daemon/caps.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/caps.c?rev=2208&root=pulseaudio&r1=2207&r2=2208&view=diff
==============================================================================
--- trunk/src/daemon/caps.c (original)
+++ trunk/src/daemon/caps.c Tue Apr  1 00:12:32 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: trunk/src/daemon/caps.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/caps.h?rev=2208&root=pulseaudio&r1=2207&r2=2208&view=diff
==============================================================================
--- trunk/src/daemon/caps.h (original)
+++ trunk/src/daemon/caps.h Tue Apr  1 00:12:32 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