summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-03-31 22:06:15 +0000
committerLennart Poettering <lennart@poettering.net>2008-03-31 22:06:15 +0000
commit6734fba80c672ff313fe3a273072a5fe61be0d0e (patch)
tree0d585a8427f8970b6dc0b45ce2825b3aa61898ad
parent78bdb978c67faa9b9f3e908b6c930438359886a3 (diff)
merge r2185 from prepare-0.9.10
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2201 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulse/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pulse/util.c b/src/pulse/util.c
index d3ac9f66..b6f57b96 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -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 @@ char *pa_get_user_name(char *s, size_t l) {
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