[pulseaudio-commits] r2185 - /branches/prepare-0.9.10/src/pulse/util.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Mar 28 10:12:02 PDT 2008


Author: lennart
Date: Fri Mar 28 18:12:01 2008
New Revision: 2185

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2185&root=pulseaudio&view=rev
Log:
if we are run as root, always use 'root' as username, regardless of any env vars

Modified:
    branches/prepare-0.9.10/src/pulse/util.c

Modified: branches/prepare-0.9.10/src/pulse/util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/prepare-0.9.10/src/pulse/util.c?rev=2185&root=pulseaudio&r1=2184&r2=2185&view=diff
==============================================================================
--- branches/prepare-0.9.10/src/pulse/util.c (original)
+++ branches/prepare-0.9.10/src/pulse/util.c Fri Mar 28 18:12:01 2008
@@ -65,7 +65,7 @@
 #include "util.h"
 
 char *pa_get_user_name(char *s, size_t l) {
-    char *p;
+    const char *p;
     char buf[1024];
 
 #ifdef HAVE_PWD_H
@@ -75,7 +75,10 @@
     pa_assert(s);
     pa_assert(l > 0);
 
-    if (!(p = getenv("USER")) && !(p = getenv("LOGNAME")) && !(p = getenv("USERNAME"))) {
+    if (!(p = (getuid() == 0 ? "root" : NULL)) &&
+        !(p = getenv("USER")) &&
+        !(p = getenv("LOGNAME")) &&
+        !(p = getenv("USERNAME"))) {
 #ifdef HAVE_PWD_H
 
 #ifdef HAVE_GETPWUID_R




More information about the pulseaudio-commits mailing list