فهرست منبع

check_mysql: Fix segfault with old slaves (#2696823 - Oskar Ahner)

Thomas Guyot-Sionnest 17 سال پیش
والد
کامیت
ab3ada9aac
3فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 1 0
      NEWS
  2. 1 0
      THANKS.in
  3. 2 1
      plugins/check_mysql.c

+ 1 - 0
NEWS

@@ -28,6 +28,7 @@ This file documents the major additions and syntax changes between releases.
 	Fixed check_http not timing-out on redirects
 	Fixed check_http not timing-out on redirects
 	Fixed negate not printing the real timeout in ALRM handler when left to default
 	Fixed negate not printing the real timeout in ALRM handler when left to default
 	negate timeout result is now configurable
 	negate timeout result is now configurable
+	Fixed segfault in check_mysql with old slaves (#2696823 - Oskar Ahner)
 
 
 1.4.13 25th Sept 2008
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

+ 1 - 0
THANKS.in

@@ -248,3 +248,4 @@ Nik Soggia
 Olli Hauer
 Olli Hauer
 Richard Edward Horner
 Richard Edward Horner
 John Barbuto
 John Barbuto
+Oskar Ahner

+ 2 - 1
plugins/check_mysql.c

@@ -177,13 +177,14 @@ main (int argc, char **argv)
 					continue;
 					continue;
 				}
 				}
 			}
 			}
+
 			if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
 			if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
 				mysql_free_result (res);
 				mysql_free_result (res);
 				mysql_close (&mysql);
 				mysql_close (&mysql);
 				die (STATE_CRITICAL, "Slave status unavailable\n");
 				die (STATE_CRITICAL, "Slave status unavailable\n");
 			}
 			}
 
 
-			snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], row[seconds_behind_field]);
+			snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown");
 			if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
 			if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
 				mysql_free_result (res);
 				mysql_free_result (res);
 				mysql_close (&mysql);
 				mysql_close (&mysql);