]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/Tools.pm
Fix next_unused_port already bin detection
[pve-common.git] / data / PVE / Tools.pm
index 05576e0f8417884513743db909bbf2a46fa90022..b666e9b8e915e7e08c4edbdac63593e071ae5a00 100644 (file)
@@ -145,8 +145,7 @@ sub lock_file_full {
        $err = $@;
     }
 
-    if ($lock_handles->{$$}->{$filename}) {
-        my $fh = $lock_handles->{$$}->{$filename};
+    if (my $fh = $lock_handles->{$$}->{$filename}) {
         $lock_handles->{$$}->{$filename} = undef;
         close ($fh);
     }
@@ -693,7 +692,7 @@ sub next_unused_port {
            next if $ports->{$p}; # reserved
 
            my $sock = IO::Socket::INET->new(Listen => 5,
-                                            LocalAddr => 'localhost',
+                                            LocalAddr => '0.0.0.0',
                                             LocalPort => $p,
                                             ReuseAddr => 1,
                                             Proto     => 0);