Index: hw/xfree86/common/xf86Init.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/common/xf86Init.c,v
retrieving revision 1.33.2.2
diff -u -u -r1.33.2.2 xf86Init.c
--- hw/xfree86/common/xf86Init.c	9 May 2006 18:04:19 -0000	1.33.2.2
+++ hw/xfree86/common/xf86Init.c	20 Jun 2006 08:33:03 -0000
@@ -1905,7 +1905,11 @@
           FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
           break;
       case 0:  /* child */
-          setuid(getuid());
+	  if (setuid(getuid()) == -1) {
+	      xf86Msg(X_ERROR, "xf86RunVtInit: setuid failed (%s)\n",
+			 strerror(errno));
+	      exit(255);
+	  }
           /* set stdin, stdout to the consoleFd */
           for (i = 0; i < 2; i++) {
             if (xf86Info.consoleFd != i) {
Index: hw/xfree86/os-support/shared/libc_wrapper.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/os-support/shared/libc_wrapper.c,v
retrieving revision 1.11
diff -u -u -r1.11 libc_wrapper.c
--- hw/xfree86/os-support/shared/libc_wrapper.c	25 Mar 2006 19:52:04 -0000	1.11
+++ hw/xfree86/os-support/shared/libc_wrapper.c	20 Jun 2006 08:33:03 -0000
@@ -1270,7 +1270,10 @@
 #ifndef SELF_CONTAINED_WRAPPER
 	xf86DisableIO();
 #endif
-        setuid(getuid());
+        if (setuid(getuid()) == -1) {
+		ErrorF("xf86Execl: setuid() failed: %s\n", strerror(errno));
+		exit(255);
+	}
 #if !defined(SELF_CONTAINED_WRAPPER)
         /* set stdin, stdout to the consoleFD, and leave stderr alone */
         for (i = 0; i < 2; i++)
Index: hw/xfree86/parser/write.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/parser/write.c,v
retrieving revision 1.3
diff -u -u -r1.3 write.c
--- hw/xfree86/parser/write.c	3 Jul 2005 07:01:37 -0000	1.3
+++ hw/xfree86/parser/write.c	20 Jun 2006 08:33:03 -0000
@@ -170,7 +170,10 @@
 					strerror(errno));
 			return 0;
 		case 0: /* child */
-			setuid(getuid());
+			if (setuid(getuid() == -1) 
+			    FatalError("xf86writeConfigFile(): "
+				"setuid failed(%s)\n", 
+				strerror(errno));
 			ret = doWriteConfigFile(filename, cptr);
 			exit(ret);
 			break;
Index: os/utils.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/os/utils.c,v
retrieving revision 1.25
diff -u -u -r1.25 utils.c
--- os/utils.c	25 Mar 2006 19:52:05 -0000	1.25
+++ os/utils.c	20 Jun 2006 08:33:04 -0000
@@ -1721,8 +1721,10 @@
     case -1:	/* error */
 	p = -1;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	execl("/bin/sh", "sh", "-c", command, (char *)NULL);
 	_exit(127);
     default:	/* parent */
@@ -1773,8 +1775,10 @@
 	xfree(cur);
 	return NULL;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	if (*type == 'r') {
 	    if (pdes[1] != 1) {
 		/* stdout */
@@ -1848,8 +1852,10 @@
 	xfree(cur);
 	return NULL;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	if (*type == 'r') {
 	    if (pdes[1] != 1) {
 		/* stdout */
