[pve-devel] [PATCH container] Fix #881: uninitialized value on valid lxc.cgroup keys

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Feb 2 08:21:12 CET 2016


We have no lxc.cgroup.* keys in $valid_lxc_conf_keys so they
and unknown keys showed an uninitialized value warning for
the new 'eq' operation.
This also avoids the second hash access.
---
 src/PVE/LXC.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 49a85b6..f761f33 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -517,9 +517,10 @@ sub parse_pct_config {
 	if ($line =~ m/^(lxc\.[a-z0-9_\-\.]+)(:|\s*=)\s*(.*?)\s*$/) {
 	    my $key = $1;
 	    my $value = $3;
-	    if ($valid_lxc_conf_keys->{$key} eq 1 || $key =~ m/^lxc\.cgroup\./) {
+	    my $validity = $valid_lxc_conf_keys->{$key} || 0;
+	    if ($validity eq 1 || $key =~ m/^lxc\.cgroup\./) {
 		push @{$conf->{lxc}}, [$key, $value];
-	    } elsif (my $errmsg = $valid_lxc_conf_keys->{$key}) {
+	    } elsif (my $errmsg = $validity) {
 		warn "vm $vmid - $key: $errmsg\n";
 	    } else {
 		warn "vm $vmid - unable to parse config: $line\n";
-- 
2.1.4





More information about the pve-devel mailing list