summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-24 06:01:48 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-24 06:01:48 (GMT)
commitab3ada9aacd82356a6e5205f3ae26bbff55524db (patch)
treec80b7aee657b34d8f018c94cac45ece1507f4c26
parentf2f2f35240c976ddc6e44cd6276df88aad812199 (diff)
downloadmonitoring-plugins-ab3ada9aacd82356a6e5205f3ae26bbff55524db.tar.gz
check_mysql: Fix segfault with old slaves (#2696823 - Oskar Ahner)
-rw-r--r--NEWS1
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_mysql.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 164ef9f..4f3a833 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ This file documents the major additions and syntax changes between releases.
28 Fixed check_http not timing-out on redirects 28 Fixed check_http not timing-out on redirects
29 Fixed negate not printing the real timeout in ALRM handler when left to default 29 Fixed negate not printing the real timeout in ALRM handler when left to default
30 negate timeout result is now configurable 30 negate timeout result is now configurable
31 Fixed segfault in check_mysql with old slaves (#2696823 - Oskar Ahner)
31 32
321.4.13 25th Sept 2008 331.4.13 25th Sept 2008
33 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) 34 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/THANKS.in b/THANKS.in
index 7737e17..30bf06c 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -248,3 +248,4 @@ Nik Soggia
248Olli Hauer 248Olli Hauer
249Richard Edward Horner 249Richard Edward Horner
250John Barbuto 250John Barbuto
251Oskar Ahner
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 119ce0a..689648e 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -177,13 +177,14 @@ main (int argc, char **argv)
177 continue; 177 continue;
178 } 178 }
179 } 179 }
180
180 if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) { 181 if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
181 mysql_free_result (res); 182 mysql_free_result (res);
182 mysql_close (&mysql); 183 mysql_close (&mysql);
183 die (STATE_CRITICAL, "Slave status unavailable\n"); 184 die (STATE_CRITICAL, "Slave status unavailable\n");
184 } 185 }
185 186
186 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]); 187 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");
187 if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { 188 if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
188 mysql_free_result (res); 189 mysql_free_result (res);
189 mysql_close (&mysql); 190 mysql_close (&mysql);