Replace hardcoded SVR4 || linux || CSRG_BASED with an autoconf check and
the _POSIX_SAVED_IDS macro.

Suggested-by: Mark Kettenis <[email protected]>
Signed-off-by: Julien Cristau <[email protected]>
---
 configure.ac              |    2 +-
 hw/xfree86/parser/write.c |    3 ++-
 include/xorg-config.h.in  |    3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index c6ecba4..d27ca23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,7 +215,7 @@ AC_SUBST(DLOPEN_LIBS)
 dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
        getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
-       mmap shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
+       mmap seteuid shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
 AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])
 
 dnl Find the math libary, then check for cbrt function in it.
diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 9c706a0..26739b9 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -55,6 +55,7 @@
 #include <xorg-config.h>
 #endif
 
+#include "os.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "Configint.h"
@@ -65,7 +66,7 @@
 #include <signal.h>
 #include <errno.h>
 
-#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
+#if defined(HAVE_SETEUID) && defined(_POSIX_SAVED_IDS) && _POSIX_SAVED_IDS > 0
 #define HAS_SAVED_IDS_AND_SETEUID
 #endif
 #if defined(WIN32)
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index a71b25d..0df31ae 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -139,4 +139,7 @@
 /* Have X server platform bus support */
 #undef XSERVER_PLATFORM_BUS
 
+/* Define to 1 if you have the `seteuid' function. */
+#undef HAVE_SETEUID
+
 #endif /* _XORG_CONFIG_H_ */
-- 
1.7.10.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to