fix #923: uninitalized value in remove_lock
authorFabian Gr├╝nbichler <f.gruenbichler@proxmox.com>
Wed, 30 Mar 2016 12:00:12 +0000 (14:00 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 1 Apr 2016 05:15:21 +0000 (07:15 +0200)
src/PVE/AbstractConfig.pm

index f1c0eb2..0799c8b 100644 (file)
@@ -136,9 +136,10 @@ sub remove_lock {
     $class->lock_config($vmid, sub {
        my $conf = $class->load_config($vmid);
        if (!$conf->{lock}) {
-           die "no lock found trying to remove lock '$lock'\n";
+           my $lockstring = defined($lock) ? "'$lock' " : "any";
+           die "no lock found trying to remove $lockstring lock\n";
        } elsif (defined($lock) && $conf->{lock} ne $lock) {
-           die "found lock '$conf->{lock}' trying to remove lock '$lock'\n";
+           die "found lock '$conf->{lock}' trying to remove '$lock' lock\n";
        }
        delete $conf->{lock};
        $class->write_config($vmid, $conf);