[pve-devel] [PATCH storage] base->activate_storage: ensure a defined path test result

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Sep 12 08:57:06 CEST 2017


If $path does not exists the '-d' check returns undef, which then
causes "Use of uninitialized value.." warning in the log.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/Storage/Plugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 6f72cee..18d780b 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -855,7 +855,7 @@ sub activate_storage {
 
     # this path test may hang indefinitely on unresponsive mounts
     my $timeout = 2;
-    if (! PVE::Tools::run_fork_with_timeout($timeout, sub {-d $path})) {
+    if (! PVE::Tools::run_fork_with_timeout($timeout, sub {-d $path // 0})) {
 	die "unable to activate storage '$storeid' - " .
 	"directory '$path' does not exist or is unreachable\n";
     }
-- 
2.11.0





More information about the pve-devel mailing list