diff options
author | Pierre Ossman <ossman@cendio.se> | 2006-07-20 13:16:23 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2006-07-20 13:16:23 +0000 |
commit | 8d2dc9c4d14fd879aac3e4137b1dfc2c32a338cb (patch) | |
tree | 948c4cc2de65dbb522a55bbf54f759b1f6d36b95 /src/daemon/main.c | |
parent | b12f29d04ba9fcaa6930d52b13880086693c0faa (diff) |
Handle user switch in a more platform independent manner.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1118 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/daemon/main.c')
-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]; |