]> git.proxmox.com Git - pve-common.git/commitdiff
cleanup: regex match group reference
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 Mar 2016 12:23:23 +0000 (13:23 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Mar 2016 16:58:08 +0000 (17:58 +0100)
Don't refer to the regex match group via $1 after running
other code.

src/PVE/Network.pm

index ac2c168c0ef718b4ec3656d2b6d1259ea6579766..56af2edae3382df2fcfd5a153448225294c8d34d 100644 (file)
@@ -539,13 +539,13 @@ sub get_active_interfaces {
     while(defined(my $line = <$fh>)) {
        next if $line !~ /^\s*([^:\s]+):/;
        my $ifname = $1;
     while(defined(my $line = <$fh>)) {
        next if $line !~ /^\s*([^:\s]+):/;
        my $ifname = $1;
-       my $ifreq = pack($STRUCT_IFREQ_SIOCGIFFLAGS, $1, 0);
+       my $ifreq = pack($STRUCT_IFREQ_SIOCGIFFLAGS, $ifname, 0);
        if (!defined(ioctl($sock, SIOCGIFFLAGS, $ifreq))) {
            warn "failed to get interface flags for: $ifname\n";
            next;
        }
        my ($name, $flags) = unpack($STRUCT_IFREQ_SIOCGIFFLAGS, $ifreq);
        if (!defined(ioctl($sock, SIOCGIFFLAGS, $ifreq))) {
            warn "failed to get interface flags for: $ifname\n";
            next;
        }
        my ($name, $flags) = unpack($STRUCT_IFREQ_SIOCGIFFLAGS, $ifreq);
-       push @$ifaces, $1 if ($flags & IFF_UP);
+       push @$ifaces, $ifname if ($flags & IFF_UP);
     }
     close $fh;
     close $sock;
     }
     close $fh;
     close $sock;