From f2f3481179c0b11430cbdb2459e21e51ff265661 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Tue, 11 Feb 2003 00:47:47 +0000 Subject: [PATCH] Patch by Dave Viner for seg fault on RH 7.3 (655903) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@316 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_mysql.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index f806a27..18324c8 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -189,25 +189,26 @@ process_arguments (int argc, char **argv) c = optind; - if (strlen(db_host) == 0 && argc > c) - if (is_host (argv[c])) { - db_host = argv[c++]; - } - else { - usage ("Invalid host name"); - } - - if (strlen(db_user) == 0 && argc > c) - db_user = argv[c++]; - - if (strlen(db_pass) == 0 && argc > c) - db_pass = argv[c++]; - - if (strlen(db) == 0 && argc > c) - db = argv[c++]; + while ( argc > c ) { - if (is_intnonneg (argv[c]) && argc > c) - db_port = atoi (argv[c++]); + if (strlen(db_host) == 0) + if (is_host (argv[c])) { + db_host = argv[c++]; + } + else { + usage ("Invalid host name"); + } + else if (strlen(db_user) == 0) + db_user = argv[c++]; + else if (strlen(db_pass) == 0) + db_pass = argv[c++]; + else if (strlen(db) == 0) + db = argv[c++]; + else if (is_intnonneg (argv[c])) + db_port = atoi (argv[c++]); + else + break; + } return validate_arguments (); } -- 2.30.2