[pve-devel] [PATCH common] network: fix uninitialized value error

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Jan 18 09:17:23 CET 2016


---
 src/PVE/Network.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 293ebfa..8cfac0d 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -177,10 +177,12 @@ my $bridge_add_interface = sub {
 	    die "unable to add default vlan tags to interface $iface\n" if !$trunks;
 	} 
 
-        my @trunks_array = split /;/, $trunks;
-	foreach my $trunk (@trunks_array) { 
-	    system("/sbin/bridge vlan add dev $iface vid $trunk") == 0 ||
-	    die "unable to add vlan $trunk to interface $iface\n";
+	if ($trunks) {
+	    my @trunks_array = split /;/, $trunks;
+	    foreach my $trunk (@trunks_array) { 
+		system("/sbin/bridge vlan add dev $iface vid $trunk") == 0 ||
+		die "unable to add vlan $trunk to interface $iface\n";
+	    }
 	}
    }
 };
-- 
2.1.4





More information about the pve-devel mailing list