vzdump: avoid passing zero to prune in legacy handling of maxfiles

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-10-23 10:05:19 +02:00
parent 5335acc01d
commit 77aea6ebcc

View File

@ -485,9 +485,8 @@ sub new {
}
if (!defined($opts->{'prune-backups'})) {
$opts->{maxfiles} //= $defaults->{maxfiles};
$opts->{'prune-backups'} = { 'keep-last' => $opts->{maxfiles} };
delete $opts->{maxfiles};
my $maxfiles = delete $opts->{maxfiles} // $defaults->{maxfiles};
$opts->{'prune-backups'} = { 'keep-last' => $maxfiles } if $maxfiles;
}
if ($opts->{tmpdir} && ! -d $opts->{tmpdir}) {