diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-09-15 13:56:31 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-09-15 14:03:11 +0100 |
commit | 404ad9dc9dfa2116d2907212d3650df6870ff9bc (patch) | |
tree | dcb1ad3996b2b2b61ebff9c3458e6dee76153dbf /perl.c | |
parent | eb863851dc760d12b53aa443481ac97240430aa7 (diff) | |
download | perl-404ad9dc9dfa2116d2907212d3650df6870ff9bc.tar.gz |
Avoid setting $! if the sitecustomize script doesn't exist.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |