summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-12-21 03:54:11 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-21 03:54:11 +0000
commit7ef822cddfe985045cd287429915d6f6aecd27c9 (patch)
treeabc607246b270b6b5758ed601238984e0a6efe80 /pp_sys.c
parentc998f3c7edf5c8e96067437acbd36abfa8cafa7c (diff)
downloadperl-7ef822cddfe985045cd287429915d6f6aecd27c9.tar.gz
Fix for 20001210.003, "write(FH) on closed FH causes segv".
p4raw-id: //depot/perl@8214
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c1857ae7c3..fe914f3267 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1236,6 +1236,8 @@ PP(pp_leavewrite)
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)
{
@@ -1356,6 +1358,7 @@ PP(pp_leavewrite)
PUSHs(&PL_sv_yes);
}
}
+bad_ofp:
PL_formtarget = PL_bodytarget;
PUTBACK;
return pop_return();