This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_last_in_gv may not be a GV if it was a stale filehandle (fix for
authorGurusamy Sarathy <gsar@cpan.org>
Mon, 14 May 2001 14:43:50 +0000 (14:43 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Mon, 14 May 2001 14:43:50 +0000 (14:43 +0000)
bug ID 20010514.027)

TODO: this needs a testsuite addition

p4raw-id: //depot/maint-5.6/perl@10100

mg.c
pp_ctl.c

diff --git a/mg.c b/mg.c
index e1b727a..0b64dae 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -661,7 +661,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
     case '.':
 #ifndef lint
        if (GvIO(PL_last_in_gv)) {
-           sv_setiv(sv, (IV)IoLINES(GvIO(PL_last_in_gv)));
+           sv_setiv(sv, (IV)IoLINES(GvIOp(PL_last_in_gv)));
        }
 #endif
        break;
index b267060..11933f7 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1029,7 +1029,7 @@ PP(pp_flip)
        if (PL_op->op_private & OPpFLIP_LINENUM) {
            struct io *gp_io;
            flip = PL_last_in_gv
-               && (gp_io = GvIOp(PL_last_in_gv))
+               && (gp_io = GvIO(PL_last_in_gv))
                && SvIV(sv) == (IV)IoLINES(gp_io);
        } else {
            flip = SvTRUE(sv);
@@ -1110,7 +1110,8 @@ PP(pp_flop)
        SV *targ = PAD_SV(cUNOP->op_first->op_targ);
        sv_inc(targ);
        if ((PL_op->op_private & OPpFLIP_LINENUM)
-         ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
+         ? (GvIO(PL_last_in_gv)
+            && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
          : SvTRUE(sv) ) {
            sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0);
            sv_catpv(targ, "E0");