diff options
author | Brian Fraser <fraserbn@gmail.com> | 2012-06-02 14:15:34 -0300 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-06-17 14:15:03 -0500 |
commit | 2433d39e67a04b5f2254b841686dd8e7336c1183 (patch) | |
tree | ebc43e9ab53f70f60c8ec067a61eb3161a080622 /pp_ctl.c | |
parent | 45e0f58a899367af7f91dfb54c94a62886b4d8e8 (diff) | |
download | perl-2433d39e67a04b5f2254b841686dd8e7336c1183.tar.gz |
require should die if a file exists but can't be read.
See [perl #113422]. If a file exists but there's an error opening it,
we throw an exception and disregard the rest of @INC.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -3690,7 +3690,7 @@ PP(pp_require) tryname = name; tryrsfp = doopen_pm(sv); } - if (!tryrsfp) { + if (!tryrsfp && !(errno == EACCES && path_is_absolute(name))) { AV * const ar = GvAVn(PL_incgv); I32 i; #ifdef VMS @@ -3882,9 +3882,14 @@ PP(pp_require) } break; } - else if (errno == EMFILE) - /* no point in trying other paths if out of handles */ - break; + else if (errno == EMFILE || errno == EACCES) { + /* no point in trying other paths if out of handles; + * on the other hand, if we couldn't open one of the + * files, then going on with the search could lead to + * unexpected results; see perl #113422 + */ + break; + } } } } @@ -3893,7 +3898,7 @@ PP(pp_require) sv_2mortal(namesv); if (!tryrsfp) { if (PL_op->op_type == OP_REQUIRE) { - if(errno == EMFILE) { + if(errno == EMFILE || errno == EACCES) { /* diag_listed_as: Can't locate %s */ DIE(aTHX_ "Can't locate %s: %s", name, Strerror(errno)); } else { |