to the call to setuid(0) if the current euid is non-zero. This
effectively restores the state of things prior to rev
7bfeb629fccb.
Fixes a problem on AIX where LDR_PRELOAD was not being honored for
the command being executed.
case PERM_ROOT:
/*
- * setreuid(0, 0) may fail on some systems
- * when the euid is not already 0.
+ * setuid(0) may fail on some systems if the euid is not already 0.
*/
- if (setreuid(-1, ROOT_UID)) {
- errstr = "setreuid(-1, ROOT_UID)";
- goto bad;
+ if (ostate->euid != ROOT_UID) {
+ if (setreuid(-1, ROOT_UID)) {
+ errstr = "setreuid(-1, ROOT_UID)";
+ goto bad;
+ }
}
if (setuid(ROOT_UID)) {
errstr = "setuid(ROOT_UID)";