Index: xserver/xorg/hw/xfree86/common/xf86Init.c =================================================================== RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/common/xf86Init.c,v retrieving revision 1.29 diff -u -u -r1.29 xf86Init.c --- xserver/xorg/hw/xfree86/common/xf86Init.c 14 Dec 2005 20:11:16 -0000 1.29 +++ xserver/xorg/hw/xfree86/common/xf86Init.c 20 Jun 2006 07:58:44 -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: xserver/xorg/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.9 diff -u -u -r1.9 libc_wrapper.c --- xserver/xorg/hw/xfree86/os-support/shared/libc_wrapper.c 3 Jul 2005 08:53:48 -0000 1.9 +++ xserver/xorg/hw/xfree86/os-support/shared/libc_wrapper.c 20 Jun 2006 07:58:45 -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: xserver/xorg/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 --- xserver/xorg/hw/xfree86/parser/write.c 3 Jul 2005 07:01:37 -0000 1.3 +++ xserver/xorg/hw/xfree86/parser/write.c 20 Jun 2006 07:58:45 -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: xserver/xorg/os/utils.c =================================================================== RCS file: /cvs/xorg/xserver/xorg/os/utils.c,v retrieving revision 1.21 diff -u -u -r1.21 utils.c --- xserver/xorg/os/utils.c 8 Nov 2005 06:33:30 -0000 1.21 +++ xserver/xorg/os/utils.c 20 Jun 2006 07:58:47 -0000 @@ -1718,8 +1718,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 */ @@ -1770,8 +1772,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 */ @@ -1845,8 +1849,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 */