]> code.delx.au - pulseaudio/blobdiff - polyp/caps.c
Merge Pierre's changes
[pulseaudio] / polyp / caps.c
index 93fca89f1f17b4571553bc0782b4c485ccdb7f2a..4ecb5848df174738280345e633a27328de892963 100644 (file)
@@ -23,9 +23,6 @@
 #include <config.h>
 #endif
 
-/* setresuid() is only available on GNU */
-#define _GNU_SOURCE
-
 #include <assert.h>
 #include <unistd.h>
 #include <errno.h>
@@ -38,6 +35,8 @@
 #include "log.h"
 #include "caps.h"
 
+#ifdef HAVE_GETUID
+
 /* Drop root rights when called SUID root */
 void pa_drop_root(void) {
     uid_t uid = getuid();
@@ -45,7 +44,7 @@ void pa_drop_root(void) {
     if (uid == 0 || geteuid() != 0)
         return;
 
-    /*     pa_log(__FILE__": dropping root rights.\n"); */
+    pa_log_info(__FILE__": dropping root rights.\n");
 
 #if defined(HAVE_SETRESUID)
     setresuid(uid, uid, uid);
@@ -57,6 +56,13 @@ void pa_drop_root(void) {
 #endif
 }
 
+#else
+
+void pa_drop_root(void) {
+}
+
+#endif
+
 #ifdef HAVE_SYS_CAPABILITY_H
 
 /* Limit capabilities set to CAPSYS_NICE */
@@ -76,7 +82,7 @@ int pa_limit_caps(void) {
     if (cap_set_proc(caps) < 0)
         goto fail;
 
-/*     pa_log(__FILE__": dropped capabilities successfully.\n"); */
+    pa_log_info(__FILE__": dropped capabilities successfully.\n"); 
     
     r = 0;