Error out if we cannot change to root's uid so we catch the failure early.

This commit is contained in:
Todd C. Miller
2010-11-23 07:25:03 -05:00
parent bb4a8a4dc2
commit d869ca1f90

View File

@@ -104,7 +104,10 @@ sudo_edit(struct command_details *command_details, char *argv[], char *envp[])
* Set real, effective and saved uids to root.
* We will change the euid as needed below.
*/
setuid(ROOT_UID);
if (setuid(ROOT_UID) != 0) {
warning("unable to change to uid to root (%u)", ROOT_UID);
return 1;
}
/*
* Find our temporary directory, one of /var/tmp, /usr/tmp, or /tmp