Просмотр исходного кода

check_log does not check for "-O oldlog"

Fix for issue #251
John C. Frickson 8 лет назад
Родитель
Сommit
662a650626
2 измененных файлов с 11 добавлено и 0 удалено
  1. 1 0
      NEWS
  2. 10 0
      plugins-scripts/check_log.sh

+ 1 - 0
NEWS

@@ -6,6 +6,7 @@ This file documents the major additions and syntax changes between releases.
 	check_ntp_time: Periodically returns "Socket timeout" when one of several ntp server doesn't respond
 	check_ntp_time calls `write` on a UDP socket without a successful call to `connect`
 	check_mysql_query & mysql_query: extra-opts causes crash
+	check_log does not check for "-O oldlog"
 
 
 2.2.1 2017-04-19

+ 10 - 0
plugins-scripts/check_log.sh

@@ -169,6 +169,16 @@ while test -n "$1"; do
     shift
 done
 
+if [ "$oldlog" = "" ]; then
+	echo "Log check error: You must supply an Old Log File name using '-O'!"
+	exit "$STATE_UNKNOWN"
+fi
+rc=`echo "$oldlog" | grep -q -- "^-"; echo $?`
+if [ $rc -eq 0 ]; then
+	echo "Log check error: You must supply an Old Log File name using '-O'!"
+	exit "$STATE_UNKNOWN"
+fi
+
 # If the source log file doesn't exist, exit
 
 if [ ! -e "$logfile" ]; then