]> git.proxmox.com Git - pve-container.git/commitdiff
Fix #881: uninitialized value on valid lxc.cgroup keys
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 2 Feb 2016 07:21:12 +0000 (08:21 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 2 Feb 2016 08:07:59 +0000 (09:07 +0100)
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

index 49a85b63b65fe5ece5099d6ed3798387c69b3539..f761f33b564e28b822bfb6d861f9ee9478774aa7 100644 (file)
@@ -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";