From: Nick Ing-Simmons Date: Sun, 25 Mar 2001 22:15:02 +0000 (+0000) Subject: Fix readline in list mode to tell rest of world that it has X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=09e8efccba1f47d53c182ecd6161dfcbbbc53b0f;p=p5sagit%2Fp5-mst-13.2.git Fix readline in list mode to tell rest of world that it has things on the stack. Otherwise if perl code gets invoked underneath it it scribbles over results-so-far. (Why TIEHANDLE has not tripped on this is a mystery.) p4raw-id: //depot/perlio@9351 --- diff --git a/pp_hot.c b/pp_hot.c index 58874a8..7a6ad32 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1511,6 +1511,7 @@ Perl_do_readline(pTHX) || (IoFLAGS(io) & IOf_NOLINE) || !RsSNARF(rs)) for (;;) { + PUTBACK; if (!sv_gets(sv, fp, offset) && (type == OP_GLOB || SNARF_EOF(gimme, PL_rs, io, sv))) { @@ -1531,6 +1532,7 @@ Perl_do_readline(pTHX) } if (gimme == G_SCALAR) { (void)SvOK_off(TARG); + SPAGAIN; PUSHTARG; } MAYBE_TAINT_LINE(io, sv); @@ -1540,6 +1542,7 @@ Perl_do_readline(pTHX) IoLINES(io)++; IoFLAGS(io) |= IOf_NOLINE; SvSETMAGIC(sv); + SPAGAIN; XPUSHs(sv); if (type == OP_GLOB) { char *tmps;