From: pxm@nubz.org Date: Sun, 5 Oct 2003 20:55:56 +0000 (+0000) Subject: [perl #24122] setreuid and friends borked on darwin/osx X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=75870ed3a2061db7a09c0f054d3cc6b0d00f0b51;p=p5sagit%2Fp5-mst-13.2.git [perl #24122] setreuid and friends borked on darwin/osx From: "pxm@nubz.org (via RT)" Message-ID: p4raw-id: //depot/perl@21440 --- diff --git a/mg.c b/mg.c index df75970..bcb0188 100644 --- a/mg.c +++ b/mg.c @@ -2240,9 +2240,14 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) #ifdef HAS_SETRESUID (void)setresuid((Uid_t)PL_uid, (Uid_t)-1, (Uid_t)-1); #else - if (PL_uid == PL_euid) /* special case $< = $> */ + if (PL_uid == PL_euid) { /* special case $< = $> */ +#ifdef PERL_DARWIN + /* workaround for Darwin's setuid peculiarity, cf [perl #24122] */ + if (PL_uid != 0 && PerlProc_getuid() == 0) + (void)PerlProc_setuid(0); +#endif (void)PerlProc_setuid(PL_uid); - else { + } else { PL_uid = PerlProc_getuid(); Perl_croak(aTHX_ "setruid() not implemented"); }