diff options
author | bah@longitude.com <bah@longitude.com> | 2006-04-15 10:13:41 -0400 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-15 23:51:10 +0000 |
commit | 8b8cacda97c80b98d5f7759a80b1954285666940 (patch) | |
tree | 8640ba9802320069597eda1512b5184e5b5188ae /pp_sys.c | |
parent | fc86f1263ad539fbebe503083dd7c866265f1ea5 (diff) | |
download | perl-8b8cacda97c80b98d5f7759a80b1954285666940.tar.gz |
Handle null io in leavewrite (not possible?) (Coverity)
Message-ID: <1661.38.96.138.153.1145124821.squirrel@mail.longitude.com>
Date: Sat, 15 Apr 2006 14:13:41 -0400 (EDT)
p4raw-id: //depot/perl@27829
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1301,16 +1301,18 @@ PP(pp_leavewrite) dVAR; dSP; GV * const gv = cxstack[cxstack_ix].blk_sub.gv; register IO * const io = GvIOp(gv); - PerlIO * const ofp = IoOFP(io); + PerlIO *ofp; PerlIO *fp; SV **newsp; I32 gimme; register PERL_CONTEXT *cx; + if (!io || !(ofp = IoOFP(io))) + goto forget_top; + DEBUG_f(PerlIO_printf(Perl_debug_log, "left=%ld, todo=%ld\n", (long)IoLINES_LEFT(io), (long)FmLINES(PL_formtarget))); - if (!io || !ofp) - goto forget_top; + if (IoLINES_LEFT(io) < FmLINES(PL_formtarget) && PL_formtarget != PL_toptarget) { |