[ 21438]
Subject: Re: [perl #24122] setreuid and friends borked on darwin/osx
From: Slaven Rezic <slaven@rezic.de>
Date: 07 Oct 2003 00:04:34 +0200
Message-ID: <87ekxq6n0t.fsf@vran.herceg.de>
[ 21440]
Subject: [perl #24122] setreuid and friends borked on darwin/osx
From: "pxm@nubz.org (via RT)" <perlbug-followup@perl.org>
Date: 5 Oct 2003 20:55:56 -0000
Message-ID: <rt-24122-65678.14.
2411168523081@rt.perl.org>
p4raw-link: @21440 on //depot/perl:
75870ed3a2061db7a09c0f054d3cc6b0d00f0b51
p4raw-link: @21438 on //depot/perl:
0cad7ed8738f312f479a2c3ee36c6cc1b76d037e
p4raw-id: //depot/maint-5.8/perl@21494
p4raw-integrated: from //depot/perl@21493 'merge in' hints/darwin.sh
(@20733..) mg.c (@21360..)
perl_subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $src/patchlevel.h`
version="${perl_revision}.${perl_version}.${perl_subversion}"
+# Pretend that Darwin doesn't know about those system calls [perl #24122]
+d_setregid='undef'
+d_setreuid='undef'
+d_setrgid='undef'
+d_setruid='undef'
+
# This was previously used in all but causes three cases
# (no -Ddprefix=, -Dprefix=/usr, -Dprefix=/some/thing/else)
# but that caused too much grief.
#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");
}