فهرست منبع

Fix Debian bug #545940: Failure when run via ePN

If Perl's "shift" function is called outside of a subroutine and without
any argument, it usually shifts @ARGV.  However, if a plugin is executed
via ePN, such a call will shift @_ instead, so we must explicitly
specify @ARGV for this to work as expected.

This fixes Debian bug #545940, see: http://bugs.debian.org/545940

Commit de7191e3424e02ba278a39b86e8b1906a25d0362 fixed the same issue for
check_disk_smb.

(Reported by Hendrik Jaeger, forwarded by Jan Wagner.)
Holger Weiss 16 سال پیش
والد
کامیت
7a661c7aed
2فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 1 1
      NEWS
  2. 4 4
      plugins-scripts/check_ircd.pl

+ 1 - 1
NEWS

@@ -16,7 +16,7 @@ This file documents the major additions and syntax changes between releases.
 	Fix regression introduced in #1867716 where partially valid performance strings would not be printed anymore
 	Fix regression introduced in #1867716 where partially valid performance strings would not be printed anymore
 	Fix regression in check_http ssl checks on some servers - make SNI an option
 	Fix regression in check_http ssl checks on some servers - make SNI an option
 	Fix guest mode support in check_disk_smb
 	Fix guest mode support in check_disk_smb
-	Fix check_disk_smb failure when run via ePN
+	Fix check_disk_smb and check_ircd failures when run via ePN
 	check_ldap now allows for specifying an empty LDAP base
 	check_ldap now allows for specifying an empty LDAP base
 	WARNINGS
 	WARNINGS
 	Updated developer documentation to say that performance labels should not have an equals sign or
 	Updated developer documentation to say that performance labels should not have an equals sign or

+ 4 - 4
plugins-scripts/check_ircd.pl

@@ -187,19 +187,19 @@ MAIN:
 
 
 	if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
 	if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
 
 
-	($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n");
+	($opt_H) || ($opt_H = shift @ARGV) || usage("Host name/address not specified\n");
 	my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
 	my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
 	($remotehost) || usage("Invalid host: $opt_H\n");
 	($remotehost) || usage("Invalid host: $opt_H\n");
 
 
-	($opt_w) || ($opt_w = shift) || ($opt_w = 50);
+	($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 50);
 	my $warn = $1 if ($opt_w =~ /^([0-9]+)$/);
 	my $warn = $1 if ($opt_w =~ /^([0-9]+)$/);
 	($warn) || usage("Invalid warning threshold: $opt_w\n");
 	($warn) || usage("Invalid warning threshold: $opt_w\n");
 
 
-	($opt_c) || ($opt_c = shift) || ($opt_c = 100);
+	($opt_c) || ($opt_c = shift @ARGV) || ($opt_c = 100);
 	my $crit = $1 if ($opt_c =~ /^([0-9]+)$/);
 	my $crit = $1 if ($opt_c =~ /^([0-9]+)$/);
 	($crit) || usage("Invalid critical threshold: $opt_c\n");
 	($crit) || usage("Invalid critical threshold: $opt_c\n");
 
 
-	($opt_p) || ($opt_p = shift) || ($opt_p = 6667);
+	($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = 6667);
 	my $remoteport = $1 if ($opt_p =~ /^([0-9]+)$/);
 	my $remoteport = $1 if ($opt_p =~ /^([0-9]+)$/);
 	($remoteport) || usage("Invalid port: $opt_p\n");
 	($remoteport) || usage("Invalid port: $opt_p\n");