summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2012-06-02 14:15:34 -0300
committerJesse Luehrs <doy@tozt.net>2012-06-17 14:15:03 -0500
commit2433d39e67a04b5f2254b841686dd8e7336c1183 (patch)
treeebc43e9ab53f70f60c8ec067a61eb3161a080622 /pp_ctl.c
parent45e0f58a899367af7f91dfb54c94a62886b4d8e8 (diff)
downloadperl-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.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 8940324402..f9e4935689 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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 {