perl/perl-5.29.5-Avoid-Use-of-uninitialized-value-res-in-numeric-eq-w.patch
2019-01-15 10:33:18 +01:00

36 lines
1.1 KiB
Diff

From c950d6fa306a1a0a1e28ece3646aec9490a7ea0e Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 15 Dec 2018 10:29:12 -0500
Subject: [PATCH] Avoid "Use of uninitialized value $res in numeric eq (==)"
warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The test within the SKIP block expects $res to be undef, but the 'skip'
condition itself expects it to be defined and numeric. So we were
getting an uninitialized value warning. In 'skip' condition, test for
definedness before numeric comparison.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/GDBM_File/t/fatal.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
index 01068f3cf4..1cbfdc6018 100644
--- a/ext/GDBM_File/t/fatal.t
+++ b/ext/GDBM_File/t/fatal.t
@@ -52,7 +52,7 @@ my $res = eval {
};
SKIP: {
- skip "Can't trigger failure", 2 if $res == 99;
+ skip "Can't trigger failure", 2 if (defined $res and $res == 99);
is $res, undef, "eval should return undef";
--
2.17.2