summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-02-15 00:58:00 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2002-02-14 21:56:52 +0000
commit90133b69afb5dccc00b1483d3839904e458ba347 (patch)
treea10c3e20b651b46dfff6c979918995f7e0f074cb /pp_sys.c
parentcd16c24cb16bb0bd0fa486b8e98c39fcf6ebcf5c (diff)
downloadperl-90133b69afb5dccc00b1483d3839904e458ba347.tar.gz
Re: bug? no warning from getc BOLLOCKS
Message-ID: <20020214235800.A12901@rafael> p4raw-id: //depot/perl@14695
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index e7e41214ec..7ce9dae24f 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1134,7 +1134,7 @@ PP(pp_getc)
{
dSP; dTARGET;
GV *gv;
- IO *io;
+ IO *io = NULL;
MAGIC *mg;
if (MAXARG == 0)
@@ -1157,8 +1157,11 @@ PP(pp_getc)
SvSetMagicSV_nosteal(TARG, TOPs);
RETURN;
}
- if (!gv || do_eof(gv)) /* make sure we have fp with something */
+ if (!gv || do_eof(gv)) { /* make sure we have fp with something */
+ if (ckWARN2(WARN_UNOPENED,WARN_CLOSED) && IoTYPE(io) != IoTYPE_WRONLY)
+ report_evil_fh(gv, io, PL_op->op_type);
RETPUSHUNDEF;
+ }
TAINT;
sv_setpv(TARG, " ");
*SvPVX(TARG) = PerlIO_getc(IoIFP(GvIOp(gv))); /* should never be EOF */