This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_sys.c:pp_stat: Change scope of havefp var
authorFather Chrysostomos <sprout@cpan.org>
Fri, 20 Jan 2012 20:59:35 +0000 (12:59 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 20 Jan 2012 22:49:08 +0000 (14:49 -0800)
This is only used in the if(gv != PL_defgv) block now.  Also, it was
being used uninitialized for bad iorefs, probably resulting in random warning suppression (untested).

pp_sys.c

index 246c9ad..b201827 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2759,7 +2759,6 @@ PP(pp_stat)
 
     if (PL_op->op_flags & OPf_REF ? (gv = cGVOP_gv, 1)
                                   : !!(sv=POPs, gv = MAYBE_DEREF_GV(sv))) {
-       bool havefp;
        if (PL_op->op_type == OP_LSTAT) {
            if (gv != PL_defgv) {
            do_fstat_warning_check:
@@ -2774,9 +2773,10 @@ PP(pp_stat)
                Perl_croak(aTHX_ "The stat preceding lstat() wasn't an lstat");
        }
 
-       havefp = FALSE;
        if (gv != PL_defgv) {
+           bool havefp;
           do_fstat_have_io:
+           havefp = FALSE;
            PL_laststype = OP_STAT;
            PL_statgv = gv ? gv : (GV *)io;
            sv_setpvs(PL_statname, "");