From: Todd C. Miller Date: Fri, 6 Feb 2004 23:08:04 +0000 (+0000) Subject: setreuid(0, 0) fails on QNX if the euid is not already 0 so set the X-Git-Tag: SUDO_1_6_8~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a622cb27951e60dda223e82b98e8c72661239417;p=sudo setreuid(0, 0) fails on QNX if the euid is not already 0 so set the euid first, then just call setuid(0) to set the real uid too. --- diff --git a/set_perms.c b/set_perms.c index 8d9e47b00..6588024ee 100644 --- a/set_perms.c +++ b/set_perms.c @@ -256,8 +256,10 @@ set_perms_suid(perm) switch (perm) { case PERM_FULL_ROOT: case PERM_ROOT: - if (setreuid(0, 0)) - fatal("setreuid(0, 0) failed, your operating system may have a broken setreuid() function\nTry running configure with --disable-setreuid", 0); + if (setreuid(-1, 0)) + fatal("setreuid(-1, 0) failed, your operating system may have a broken setreuid() function\nTry running configure with --disable-setreuid", 0); + if (setuid(0)) + fatal("setuid(0)", 1); break; case PERM_USER: