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.eb...@proxmox.com>
---

New in v3.

 PVE/VZDump.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 152eb3e5..72461f73 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -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 $parse_prune_backups_maxfiles = sub {
@@ -149,7 +151,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
@@ -161,6 +163,8 @@ my $parse_prune_backups_maxfiles = sub {
            $param->{'prune-backups'} = { 'keep-all' => 1 };
        }
     }
+
+    return $param->{'prune-backups'};
 };
 
 sub storage_info {
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to