diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-02-11 00:47:47 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-02-11 00:47:47 +0000 |
commit | f2f3481179c0b11430cbdb2459e21e51ff265661 (patch) | |
tree | 3b9a66f0255ecc4322d631834b03d61ce4956bde | |
parent | cbdef12b91c1aa06d703fe5fdf7b053e0ed41c93 (diff) | |
download | monitoring-plugins-f2f3481179c0b11430cbdb2459e21e51ff265661.tar.gz |
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
-rw-r--r-- | plugins/check_mysql.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index f806a279..18324c81 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 (); } |