]> git.proxmox.com Git - pve-storage.git/commitdiff
fixup error messages when getting file size info master
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 30 Apr 2024 07:53:43 +0000 (09:53 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Apr 2024 08:16:35 +0000 (10:16 +0200)
The assignment happens before the 'die', so the error message would
always contain 'undef'.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Storage/Plugin.pm

index 683190b0d16a462e933ff146d67ae02e6a4bde63..b5a54c100e8c1b35b340633acd6e0966eb05e3ee 100644 (file)
@@ -974,13 +974,16 @@ sub file_size_info {
 
     my ($size, $format, $used, $parent) = $info->@{qw(virtual-size format actual-size backing-filename)};
 
-    ($size) = ($size =~ /^(\d+)$/) or die "size '$size' not an integer\n"; # untaint
+    ($size) = ($size =~ /^(\d+)$/); # untaint
+    die "size '$size' not an integer\n" if !defined($size);
     # coerce back from string
     $size = int($size);
-    ($used) = ($used =~ /^(\d+)$/) or die "used '$used' not an integer\n"; # untaint
+    ($used) = ($used =~ /^(\d+)$/); # untaint
+    die "used '$used' not an integer\n" if !defined($used);
     # coerce back from string
     $used = int($used);
-    ($format) = ($format =~ /^(\S+)$/) or die "format '$format' includes whitespace\n"; # untaint
+    ($format) = ($format =~ /^(\S+)$/); # untaint
+    die "format '$format' includes whitespace\n" if !defined($format);
     if (defined($parent)) {
        ($parent) = ($parent =~ /^(\S+)$/); # untaint
     }