Apply #ifdefs around functionality not available on win32

And also the reverse: around some win32 specific functionality
This commit is contained in:
Maarten Bosmans 2011-01-06 00:51:33 +01:00
parent 0ac0479534
commit bb12ff8356
20 changed files with 120 additions and 13 deletions

View file

@ -75,11 +75,15 @@ char *pa_get_user_name(char *s, size_t l) {
pa_assert(s);
pa_assert(l > 0);
if ((p = (getuid() == 0 ? "root" : NULL)) ||
(p = getenv("USER")) ||
(p = getenv("LOGNAME")) ||
(p = getenv("USERNAME")))
{
p = NULL;
#ifdef HAVE_GETUID
p = getuid() == 0 ? "root" : NULL;
#endif
if (!p) p = getenv("USER");
if (!p) p = getenv("LOGNAME");
if (!p) p = getenv("USERNAME");
if (p) {
name = pa_strlcpy(s, p, l);
} else {
#ifdef HAVE_PWD_H