version_cmp: give info about caller on error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-11-25 11:16:38 +01:00
parent de64f10114
commit cbfff937ae

View File

@ -122,7 +122,11 @@ sub version_cmp {
my $size = scalar(@versions);
return 0 if $size == 0;
die "cannot compare odd count of versions" if $size & 1;
if ($size & 1) {
my (undef, $fn, $line) = caller(0);
die "cannot compare odd count of versions, called from $fn:$line\n";
}
for (my $i = 0; $i < $size; $i += 2) {
my ($a, $b) = splice(@versions, 0, 2);