Przeglądaj źródła

Fix #663 - close MAILQ before analyzing the return code

`$?` is only set *after* `close()` has been called.

This fixes the issue where Postfix' `mailq` can't read the queue and returns garbage which can't be parsed by the later code.

Fixes #663
Evgeni Golov 3 lat temu
rodzic
commit
b56fd78016
1 zmienionych plików z 2 dodań i 0 usunięć
  1. 2 0
      plugins-scripts/check_mailq.pl

+ 2 - 0
plugins-scripts/check_mailq.pl

@@ -342,6 +342,8 @@ elsif ( $mailq eq "postfix" ) {
 
 
 	@lines = reverse <MAILQ>;
+	
+	close(MAILQ);
 
         if ( $? ) {
 		print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ$mailq_args",$/;