[pve-devel] [PATCH storage] diskmanage: fix determining array length

Fabian Ebner f.ebner at proxmox.com
Mon Jun 14 13:40:40 CEST 2021


$#* is the last index, not the length.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/Diskmanage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 55da2e5..ca6f0b7 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -915,7 +915,7 @@ sub wipe_blockdev {
 	push $to_wipe->@*, "/dev/${part}" if -b "/dev/${part}";
     });
 
-    if (scalar($to_wipe->$#*) > 0) {
+    if (scalar($to_wipe->@*) > 0) {
 	print "found child partitions to wipe: ". join(', ', $to_wipe->@*) ."\n";
     }
     push $to_wipe->@*, $devpath; # put actual device last
-- 
2.30.2






More information about the pve-devel mailing list