summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-10 14:02:45 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-10 15:49:10 -0700
commitca86716259195ac20de0ed1daf63e90535e872c0 (patch)
tree78349a584ab8cc88493409ae9c1c61cae13414f4 /doio.c
parent93e94d8ade64ced372985ff8643fa9a4e05d6e90 (diff)
downloadperl-ca86716259195ac20de0ed1daf63e90535e872c0.tar.gz
-l followed by bareword should leave the stack alone
$ ln -s /usr/bin/perl bar $ perl -le' print "bar", -l foo' 1 The -l ate my bar. It’s this naughty piece of code in doio.c:Perl_my_lstat_flags that is the culprit: if (ckWARN(WARN_IO)) { Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s", GvENAME(cGVOP_gv)); return (PL_laststatval = -1); } When -l is followed by a bareward, it has no argument on the stack, but the filetest op itself is a gvop. That snippet is from the bare- word-handling code. So, if warnings are off, it falls through to the argument-on-the-stack code and pops off something does not belong to it (that belong to the print, in the example above).
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 4626da1627..1ce6acc4ae 100644
--- a/doio.c
+++ b/doio.c
@@ -1344,8 +1344,8 @@ Perl_my_lstat_flags(pTHX_ const U32 flags)
if (ckWARN(WARN_IO)) {
Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
GvENAME(cGVOP_gv));
- return (PL_laststatval = -1);
}
+ return (PL_laststatval = -1);
}
else if (PL_laststype != OP_LSTAT
&& (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))