mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
Apply #ifdefs around functionality not available on win32
And also the reverse: around some win32 specific functionality
This commit is contained in:
parent
0ac0479534
commit
bb12ff8356
20 changed files with 120 additions and 13 deletions
|
|
@ -585,10 +585,12 @@ static char *get_old_legacy_runtime_dir(void) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETUID
|
||||
if (st.st_uid != getuid()) {
|
||||
pa_xfree(p);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
@ -607,10 +609,12 @@ static char *get_very_old_legacy_runtime_dir(void) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETUID
|
||||
if (st.st_uid != getuid()) {
|
||||
pa_xfree(p);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
@ -997,6 +1001,7 @@ int pa_context_connect(
|
|||
/* Set up autospawning */
|
||||
if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
|
||||
|
||||
#ifdef HAVE_GETUID
|
||||
if (getuid() == 0)
|
||||
pa_log_debug("Not doing autospawn since we are root.");
|
||||
else {
|
||||
|
|
@ -1005,6 +1010,7 @@ int pa_context_connect(
|
|||
if (api)
|
||||
c->spawn_api = *api;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue