summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-15 13:56:31 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-15 14:03:11 +0100
commit404ad9dc9dfa2116d2907212d3650df6870ff9bc (patch)
treedcb1ad3996b2b2b61ebff9c3458e6dee76153dbf /perl.c
parenteb863851dc760d12b53aa443481ac97240430aa7 (diff)
downloadperl-404ad9dc9dfa2116d2907212d3650df6870ff9bc.tar.gz
Avoid setting $! if the sitecustomize script doesn't exist.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index 7876adfdd4..6cf99f1b92 100644
--- a/perl.c
+++ b/perl.c
@@ -1942,8 +1942,13 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
#ifdef USE_SITECUSTOMIZE
if (!minus_f) {
+ /* SITELIB_EXP is a function call on Win32.
+ The games with local $! are to avoid setting errno if there is no
+ sitecustomize script. */
+ const char *const sitelib = SITELIB_EXP;
(void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
- Perl_newSVpvf(aTHX_ "BEGIN { do '%s/sitecustomize.pl' }", SITELIB_EXP));
+ Perl_newSVpvf(aTHX_
+ "BEGIN { do {local $!; -f '%s/sitecustomize.pl'} && do '%s/sitecustomize.pl' }", sitelib, sitelib));
}
#endif