diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-20 13:12:14 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-20 14:49:08 -0800 |
commit | 05bb32d213ce171a55a6a7226fba6f1f1fea3fd6 (patch) | |
tree | fbb613d8bfaa05bb03479116e0a9da8783f542a1 | |
parent | b8413ac3c2aeba8d9cbe9ce77d7eafc3f5ae0fef (diff) | |
download | perl-05bb32d213ce171a55a6a7226fba6f1f1fea3fd6.tar.gz |
Warn for stat(*unopened) after statting file
Statting an existing file used to prevent a subsequent stat(*unopened)
from warning if the GV happened to have no IO. If the GV *did* have
an IO, but an unopened one, it *would* warn.
This inconsistency was introduced in 5.10.0 with commit 5228a96c60
(which was also backported to 5.8.9).
-rw-r--r-- | pp_sys.c | 1 | ||||
-rw-r--r-- | t/lib/warnings/pp_sys | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -2796,6 +2796,7 @@ PP(pp_stat) PL_laststatval = -1; } } + else PL_laststatval = -1; if (PL_laststatval < 0 && !havefp) report_evil_fh(gv); } diff --git a/t/lib/warnings/pp_sys b/t/lib/warnings/pp_sys index 03492c261f..f0a56275a2 100644 --- a/t/lib/warnings/pp_sys +++ b/t/lib/warnings/pp_sys @@ -585,16 +585,21 @@ close STDIN ; stat(STDIN) ; -T HOCUS; stat(POCUS); +stat "../test.pl"; +stat *foo; no warnings qw(unopened closed) ; -T STDIN ; stat(STDIN); -T HOCUS; stat(POCUS); +stat "../test.pl"; +stat *foo; EXPECT -T on closed filehandle STDIN at - line 4. stat() on closed filehandle STDIN at - line 5. -T on unopened filehandle HOCUS at - line 6. stat() on unopened filehandle POCUS at - line 7. +stat() on unopened filehandle foo at - line 9. ######## # pp_sys.c [pp_fttext] use warnings 'newline' ; |