From a29328e7fa19d29cc0920c8d9164f92287d45ce4 Mon Sep 17 00:00:00 2001 From: Kevin Scott Adams Date: Mon, 9 Jul 2018 15:38:54 -0400 Subject: [PATCH] Undef $iscsi_lunid in FreeNAS.pm on line 457 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The perl code was creating a new variable in the ‘if’ code block by using 'my' at the beginning of the assignment at line 452. Once the code exited this block that variable was released and now defaulted to the main block variable at line 441 which is still set to 'undef'. Removing the 'my' from the assignment line allowed the code to use the main block $iscsi_lunid variable. Fixes issue #7 --- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 84c961e..3612ab0 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -449,7 +449,7 @@ sub freenas_list_lu { foreach my $node (@$extents) { if($node->{'id'} == $item->{'iscsi_extent'}) { if ($item->{'iscsi_lunid'} =~ /(\d+)/) { - my $iscsi_lunid = "$1"; + $iscsi_lunid = "$1"; } else { syslog("info", "FreeNAS::API::freenas_list_lu : iscsi_lunid did not pass tainted testing"); next;