Check setuid() return value. Bugzilla #7116.

This commit is contained in:
Matthieu Herrb 2006-06-20 21:07:53 +02:00
commit 2b58685402
4 changed files with 26 additions and 10 deletions

View file

@ -1896,7 +1896,11 @@ xf86RunVtInit(void)
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) {

View file

@ -1270,7 +1270,10 @@ xf86execl(const char *pathname, const char *arg, ...)
#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++)

View file

@ -170,7 +170,10 @@ xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
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;