From 4a9db9541d7a6df23aad363c6cf25cbe8341c962 Mon Sep 17 00:00:00 2001 From: Christoph Klaffl Date: Tue, 3 Dec 2024 19:32:47 +0100 Subject: [PATCH] fix warning in edge cases ("Use of uninitialized value in numeric comparison") --- syncoid | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syncoid b/syncoid index 79ad45f0..f3cac71b 100755 --- a/syncoid +++ b/syncoid @@ -1535,7 +1535,12 @@ sub sortsnapshots { if (defined $snaps->{'source'}{$left}{'createtxg'} && defined $snaps->{'source'}{$right}{'createtxg'}) { return $snaps->{'source'}{$left}{'createtxg'} <=> $snaps->{'source'}{$right}{'createtxg'}; } - return $snaps->{'source'}{$left}{'creation'} <=> $snaps->{'source'}{$right}{'creation'}; + + if (defined $snaps->{'source'}{$left}{'creation'} && defined $snaps->{'source'}{$right}{'creation'}) { + return $snaps->{'source'}{$left}{'creation'} <=> $snaps->{'source'}{$right}{'creation'}; + } + + return 0; } sub getoldestsnapshot {