From: Mike Blackwell Date: Fri, 7 Oct 2011 18:09:54 +0000 (-0500) Subject: Fix uninitialized string warnings when host or port not specified (eg using dbservice) X-Git-Tag: 2.19.0~31 X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=36675f2ab3748c7f261545ae72255b1864c5d9d2;p=check_postgres.git Fix uninitialized string warnings when host or port not specified (eg using dbservice) --- diff --git a/check_postgres.pl b/check_postgres.pl index cf9557fe1..d966daf5d 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -1385,21 +1385,21 @@ sub add_response { ## Databases $number = 1; - my %dlist = map { $_->{dbname}, $number++; } @targetdb; + my %dlist = map { ($_->{dbname} || ''), $number++; } @targetdb; if (keys %dlist > 1 and ! $historical) { my $dblist = join ',' => sort { $dlist{$a} <=> $dlist{$b} } keys %dlist; $dbname = qq{ (databases:$dblist)}; } ## Hosts $number = 1; - my %hostlist = map { $_->{host}, $number++; } @targetdb; + my %hostlist = map { ($_->{host} || ''), $number++; } @targetdb; if (keys %hostlist > 1 and ! $historical) { my $dblist = join ',' => sort { $hostlist{$a} <=> $hostlist{$b} } keys %hostlist; $dbhost = qq{ (hosts:$dblist)}; } ## Ports $number = 1; - my %portlist = map { $_->{port}, $number++; } @targetdb; + my %portlist = map { i($_->{port} || ''), $number++; } @targetdb; if (keys %portlist > 1 and ! $historical) { my $dblist = join ',' => sort { $portlist{$a} <=> $portlist{$b} } keys %portlist; $dbport = qq{ (ports:$dblist)};