Check set[e]uid return code

This commit is contained in:
Frank Denis 2013-05-20 10:27:23 -07:00
parent 59dbaf2b50
commit ac7cbd4435

View File

@ -167,8 +167,9 @@ do_chroot(char *newroot)
if (chroot(newroot) != 0 || chdir("/") != 0) if (chroot(newroot) != 0 || chdir("/") != 0)
err(1, "%s", newroot); err(1, "%s", newroot);
seteuid(geteuid()); if (seteuid(geteuid()) != 0 || setuid(getuid()) != 0) {
setuid(getuid()); err(1, "set[e]uid()");
}
#else #else
warnx("chroot not available"); warnx("chroot not available");
#endif #endif