mon/mon.cgi-1.52-fix_perl_syntax.patch
2026-05-06 13:52:56 +02:00

50 lines
2.2 KiB
Diff

diff -u -r mon.cgi-1.52.orig/mon.cgi mon.cgi-1.52/mon.cgi
--- mon-1.2.0.orig/mon.cgi-1.52/mon.cgi 2026-05-04 18:32:01.686268218 +0200
+++ mon-1.2.0/mon.cgi-1.52/mon.cgi 2026-05-04 18:38:24.023607919 +0200
@@ -963,8 +963,8 @@
}
}
- &list_status($detail_level, %op_failure) if defined(%op_failure);
- &list_status($detail_level, %op_success) if defined(%op_success);
+ &list_status($detail_level, %op_failure) if %op_failure;
+ &list_status($detail_level, %op_success) if %op_success;
$webpage->print("</table>\n");
@@ -1038,7 +1038,7 @@
if ($detail_level eq "full") {
# get a list of members of the group if we haven't already
# we need the defined() to deal with certain empty groups
- $group_list{$group} = [ &mon_list_group($group) ] unless defined(@{$group_list{$group}});
+ $group_list{$group} = [ &mon_list_group($group) ] unless exists($group_list{$group}) && @{$group_list{$group}};
}
foreach $service (sort keys %{$op{$group}}) { #begin service loop
$s = \%{$op{$group}->{$service}};
@@ -1243,7 +1243,7 @@
}
}
# print the OK, no disabled services for this host if any exist
- if ( defined(@{ $ONDS{$group} }) ) {
+ if ( exists $ONDS{$group} && @{ $ONDS{$group} } ) {
$td_bg_color = ( ($watch_disabled_string ne "") || ($host_disabled_string ne "") ) ? $disabled_color : $BGCOLOR ;
$webpage->print("<tr>\n");
$webpage->print("<td align=left bgcolor=\"$td_bg_color\">");
@@ -1610,7 +1610,7 @@
# and report back if it is (because the status might not have updated
# yet...)
@pids = &mon_list_pids;
- if (!defined(@pids)) {
+ if (!@pids) {
$webpage->print("<font size=+1>Unable to to determine whether this service is currently being tested (list_pids failed)!</font>\n");
} else {
shift @pids; #discard server PID, we don't need it
@@ -2035,7 +2035,7 @@
print $webpage->hr;
print $webpage->h2("List of mon PID's:");
- $webpage->print("Unable to list PID's on server!<br>\n") if !defined(@pids);
+ $webpage->print("Unable to list PID's on server!<br>\n") if !@pids;
my $server = shift @pids;
$webpage->print ("<font size=+0>Server PID is $server</font><br><br>\n");