SF.net SVN: nagiosplug:[2184] nagiosplug/trunk

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2184
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2184&view=rev
Author:   dermoth
Date:     2009-03-24 06:03:12 +0000 (Tue, 24 Mar 2009)

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

From: Thomas Guyot-Sionnest <[email protected]>

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/THANKS.in
    nagiosplug/trunk/plugins/check_mysql.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2009-03-24 05:52:15 UTC (rev 2183)
+++ nagiosplug/trunk/NEWS	2009-03-24 06:03:12 UTC (rev 2184)
@@ -28,6 +28,7 @@
 	Fixed check_http not timing-out on redirects
 	Fixed negate not printing the real timeout in ALRM handler when left to default
 	negate timeout result is now configurable
+	Fixed segfault in check_mysql with old slaves (#2696823 - Oskar Ahner)
 
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2009-03-24 05:52:15 UTC (rev 2183)
+++ nagiosplug/trunk/THANKS.in	2009-03-24 06:03:12 UTC (rev 2184)
@@ -248,3 +248,4 @@
 Olli Hauer
 Richard Edward Horner
 John Barbuto
+Oskar Ahner

Modified: nagiosplug/trunk/plugins/check_mysql.c
===================================================================
--- nagiosplug/trunk/plugins/check_mysql.c	2009-03-24 05:52:15 UTC (rev 2183)
+++ nagiosplug/trunk/plugins/check_mysql.c	2009-03-24 06:03:12 UTC (rev 2184)
@@ -177,13 +177,14 @@
 					continue;
 				}
 			}
+
 			if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
 				mysql_free_result (res);
 				mysql_close (&mysql);
 				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) {
 				mysql_free_result (res);
 				mysql_close (&mysql);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.