diff --git a/src/daemon/main.c b/src/daemon/main.c index 517d99845..8b905b310 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include @@ -46,6 +44,13 @@ #include #endif +#ifdef HAVE_PWD_H +#include +#endif +#ifdef HAVE_GRP_H +#include +#endif + #ifdef HAVE_LIBWRAP #include #include @@ -155,6 +160,8 @@ static void close_pipe(int p[2]) { #define set_env(key, value) putenv(pa_sprintf_malloc("%s=%s", (key), (value))) +#if defined(HAVE_PWD_H) && defined(HAVE_GRP_H) + static int change_user(void) { struct passwd *pw; struct group * gr; @@ -241,6 +248,15 @@ static int change_user(void) { return 0; } +#else /* HAVE_PWD_H && HAVE_GRP_H */ + +static int change_user(void) { + pa_log(__FILE__": System wide mode unsupported on this platform."); + return -1; +} + +#endif /* HAVE_PWD_H && HAVE_GRP_H */ + static int create_runtime_dir(void) { char fn[PATH_MAX];