From 4fc9d215202b494a9182913f84eb41ba2bd1e39b Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Tue, 20 Jun 2006 19:25:51 +0000 Subject: Check setuid() return value. Bugzilla #7116. --- xinit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'xinit.c') diff --git a/xinit.c b/xinit.c index 956d78a..818f754 100644 --- a/xinit.c +++ b/xinit.c @@ -692,7 +692,10 @@ static int startClient(char *client[]) { if ((clientpid = vfork()) == 0) { - setuid(getuid()); + if (setuid(getuid()) == -1) { + Error("cannot change uid: %s\n", strerror(errno)); + _exit(ERR_EXIT); + } setpgrp(0, getpid()); environ = newenviron; #ifdef __UNIXOS2__ -- cgit v1.2.3