summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doio.c3
-rw-r--r--t/op/filetest.t8
2 files changed, 9 insertions, 2 deletions
diff --git a/doio.c b/doio.c
index b0c5a690c5..1a031034ac 100644
--- a/doio.c
+++ b/doio.c
@@ -1336,12 +1336,13 @@ Perl_my_lstat_flags(pTHX_ const U32 flags)
Perl_croak(aTHX_ no_prev_lstat);
return PL_laststatval;
}
+ PL_laststatval = -1;
if (ckWARN(WARN_IO)) {
Perl_warner(aTHX_ packWARN(WARN_IO),
"Use of -l on filehandle %"HEKf,
HEKfARG(GvENAME_HEK(cGVOP_gv)));
}
- return (PL_laststatval = -1);
+ return -1;
}
else if (PL_op->op_private & OPpFT_STACKED) {
if (PL_laststype != OP_LSTAT)
diff --git a/t/op/filetest.t b/t/op/filetest.t
index 26d3cddcdf..86ad23546f 100644
--- a/t/op/filetest.t
+++ b/t/op/filetest.t
@@ -10,7 +10,7 @@ BEGIN {
}
use Config;
-plan(tests => 44 + 27*14);
+plan(tests => 45 + 27*14);
ok( -d 'op' );
ok( -f 'TEST' );
@@ -237,6 +237,12 @@ for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") {
is $foo[0], "bar", '-l bareword does not corrupt the stack';
}
+# -l and fatal warnings
+stat "test.pl";
+eval { use warnings FATAL => io; -l cradd };
+ok !stat _,
+ 'fatal warnings do not prevent -l HANDLE from setting stat status';
+
# File test ops should not call get-magic on the topmost SV on the stack if
# it belongs to another op.
{