diff options
-rw-r--r-- | src/daemon/main.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c index 517d9984..8b905b31 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -37,8 +37,6 @@ #include <unistd.h> #include <locale.h> #include <sys/types.h> -#include <pwd.h> -#include <grp.h> #include <liboil/liboil.h> @@ -46,6 +44,13 @@ #include <sys/ioctl.h> #endif +#ifdef HAVE_PWD_H +#include <pwd.h> +#endif +#ifdef HAVE_GRP_H +#include <grp.h> +#endif + #ifdef HAVE_LIBWRAP #include <syslog.h> #include <tcpd.h> @@ -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]; |