]> git.proxmox.com Git - pve-manager.git/commitdiff
vzdump: have property string helpers always return the result
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 11 Apr 2024 08:13:24 +0000 (10:13 +0200)
committerFiona Ebner <f.ebner@proxmox.com>
Fri, 19 Apr 2024 13:57:23 +0000 (15:57 +0200)
Previously, the result would only be returned implicitly and if not
already parsed. While callers do not strictly need the return value,
future callers might mistakenly rely on it and even work by chance in
some scenarios, because of the implicit return. Make the code more
future proof by explicitly returning the result in all cases.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/VZDump.pm

index 02244cd795c6e6d12dc54d90dad59bcc8dfa10ad..8a0dd40f25dd41094490e5adf41a72a9a9a09547 100644 (file)
@@ -134,9 +134,11 @@ my sub parse_performance {
     my ($param) = @_;
 
     if (defined(my $perf = $param->{performance})) {
-       return if ref($perf) eq 'HASH'; # already parsed
+       return $perf if ref($perf) eq 'HASH'; # already parsed
        $param->{performance} = PVE::JSONSchema::parse_property_string('backup-performance', $perf);
     }
+
+    return $param->{performance};
 }
 
 my sub merge_performance {
@@ -160,7 +162,7 @@ my $parse_prune_backups_maxfiles = sub {
         if defined($maxfiles) && defined($prune_backups);
 
     if (defined($prune_backups)) {
-       return if ref($prune_backups) eq 'HASH'; # already parsed
+       return $prune_backups if ref($prune_backups) eq 'HASH'; # already parsed
        $param->{'prune-backups'} = PVE::JSONSchema::parse_property_string(
            'prune-backups',
            $prune_backups
@@ -172,6 +174,8 @@ my $parse_prune_backups_maxfiles = sub {
            $param->{'prune-backups'} = { 'keep-all' => 1 };
        }
     }
+
+    return $param->{'prune-backups'};
 };
 
 sub storage_info {