5
0
mirror of git://git.proxmox.com/git/pve-guest-common.git synced 2025-01-10 01:17:51 +03:00

print snapshot tree: clamp indentation length to positive

If a user has many snapshots, the length heuristic can go negative
and produce wrong indentation, so clamp it at 0.

Reported in the forum: https://forum.proxmox.com/threads/105740/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-02-28 15:46:46 +01:00 committed by Thomas Lamprecht
parent 6a5f25ee19
commit 9fca8f9d5e

View File

@ -157,6 +157,7 @@ sub print_snapshot_tree {
}
my $len = 30 - length($prefix); # for aligning the description
$len = 0 if $len < 0;
printf("%s %-${len}s %-23s %s\n", $prefix, $root, $timestring, $description);
if ($e->{children}) {