Code

Patch by Dave Viner for seg fault on RH 7.3 (655903)
authorTon Voon <tonvoon@users.sourceforge.net>
Tue, 11 Feb 2003 00:47:47 +0000 (00:47 +0000)
committerTon Voon <tonvoon@users.sourceforge.net>
Tue, 11 Feb 2003 00:47:47 +0000 (00:47 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@316 f882894a-f735-0410-b71e-b25c423dba1c

plugins/check_mysql.c

index f806a2799dbfacf200843b4ca1643edd4ab3be07..18324c81784ff100ae02fc40f7a7022b943b5715 100644 (file)
@@ -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 ();
 }