[pulseaudio-commits] r1118 - /trunk/src/daemon/main.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Jul 20 06:16:24 PDT 2006


Author: ossman
Date: Thu Jul 20 15:16:23 2006
New Revision: 1118

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1118&root=pulseaudio&view=rev
Log:
Handle user switch in a more platform independent manner.

Modified:
    trunk/src/daemon/main.c

Modified: trunk/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/main.c?rev=1118&root=pulseaudio&r1=1117&r2=1118&view=diff
==============================================================================
--- trunk/src/daemon/main.c (original)
+++ trunk/src/daemon/main.c Thu Jul 20 15:16:23 2006
@@ -37,13 +37,18 @@
 #include <unistd.h>
 #include <locale.h>
 #include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
 
 #include <liboil/liboil.h>
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
+#endif
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
 #endif
 
 #ifdef HAVE_LIBWRAP
@@ -155,6 +160,8 @@
 
 #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 @@
     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];
 




More information about the pulseaudio-commits mailing list