diff options
| author | Lennart Poettering <lennart@poettering.net> | 2008-03-28 17:12:01 +0000 | 
|---|---|---|
| committer | Lennart Poettering <lennart@poettering.net> | 2008-03-28 17:12:01 +0000 | 
| commit | 13b99517ab131e013e3cdb7b50a2c80cdadc75f5 (patch) | |
| tree | 7c054b5d36f0ed439ebeb97731a9b3a74c0c105f | |
| parent | 8e60b01a5ec5d49c75b73401f652d73a004ae805 (diff) | |
if we are run as root, always use 'root' as username, regardless of any env vars
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2185 fefdeb5f-60dc-0310-8127-8f9354f1896f
| -rw-r--r-- | src/pulse/util.c | 7 | 
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 | 
