summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-24 18:25:05 +0100
committerNicholas Clark <nick@ccl4.org>2012-02-24 21:54:19 +0100
commit401c7faa7c7075c00165c1121a2f894081ab3a4b (patch)
treefbb4b2babded6e734e2a891536361bf6495a31f2
parent24454705b984a4438067eb52f40885e5dae44861 (diff)
downloadperl-nicholas/RT37033-followup.tar.gz
Remove the never-working mktemp() fallback code for FAKE_BIT_BUCKETnicholas/RT37033-followup
A working /dev/null is needed for the implementation of -e Catamount doesn't have a /dev/null, so it sets FAKE_BIT_BUCKET to enable emulation code, which fakes the bit bucket with a very short lived temporary file. FAKE_BIT_BUCKET had conditionally complied code to create the temporary file with mkstemp() if the platform has it, with the *intent* to fall back to mktemp() otherwise. However, the mktemp() code did not work (and could never have done so), but the problems were concealed by a combination of things. The code was never actually compiled in, as it was guarded by #ifdef HAS_MKTEMP, a CPP symbol that the core never defines. The core has assumed since perl-1.0 that mktemp() is always available. However, because the code (if run) only changes scriptname from BIT_BUCKET, it wasn't easily noticed that it didn't run, because on any platform with a valid working BIT_BUCKET, the subsequent open (of it, not the tempfile) would succeed, and nothing would fail. When the CPP conditionals are removed, such that the code runs, it then *fails*, because mktemp() only creates a file *name*, but doesn't actually create it on disk, so the subsequent open fails.
-rw-r--r--perl.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/perl.c b/perl.c
index 0058a3ce4b..8086ab2ef0 100644
--- a/perl.c
+++ b/perl.c
@@ -3707,11 +3707,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript)
} else
Perl_croak(aTHX_ err);
#else
-# ifdef HAS_MKTEMP
- scriptname = mktemp(tmpname);
- if (!scriptname)
- Perl_croak(aTHX_ err);
-# endif
+#error Need mkstemp() for FAKE_BIT_BUCKET
#endif
}
#endif