[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2069] nagiosplug/trunk/lib

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Wed Nov 5 17:16:00 CET 2008


Revision: 2069
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2069&view=rev
Author:   dermoth
Date:     2008-11-05 16:15:59 +0000 (Wed, 05 Nov 2008)

Log Message:
-----------
Fix calculation of extra-opts parameters.

By reading the current list instead of the additional one when counting parameters, extra-opts calculation was allocating insuficient space for the final array if later sections contained more arguments than the sum of all previously parsed sections.

Modified Paths:
--------------
    nagiosplug/trunk/lib/extra_opts.c
    nagiosplug/trunk/lib/tests/test_opts.c

Modified: nagiosplug/trunk/lib/extra_opts.c
===================================================================
--- nagiosplug/trunk/lib/extra_opts.c	2008-11-05 12:19:44 UTC (rev 2068)
+++ nagiosplug/trunk/lib/extra_opts.c	2008-11-05 16:15:59 UTC (rev 2069)
@@ -103,14 +103,13 @@
 				ea_tmp=extra_args;
 				while(ea_tmp->next) {
 					ea_tmp=ea_tmp->next;
-					ea_num++;
 				}
 				ea_tmp->next=ea1;
+				while(ea1=ea1->next) ea_num++;
 			}
 			ea1=ea_tmp=NULL;
 		}
-		/* lather, rince, repeat */
-	}
+	} /* lather, rince, repeat */
 
 	if(ea_num==*argc && extra_args==NULL){
 		/* No extra-opts */

Modified: nagiosplug/trunk/lib/tests/test_opts.c
===================================================================
--- nagiosplug/trunk/lib/tests/test_opts.c	2008-11-05 12:19:44 UTC (rev 2068)
+++ nagiosplug/trunk/lib/tests/test_opts.c	2008-11-05 16:15:59 UTC (rev 2069)
@@ -276,7 +276,7 @@
 	argv_test=(char **)malloc(4*sizeof(char **));
 	argv_test[0] = "check_tcp";
 	argv_test[1] = "--extra-opts";
-	argv_test[2] = "--extra-opts=tcp_long_lines at plugins.ini";
+	argv_test[2] = "--extra-opts=tcp_long_lines";
 	argv_test[3] = NULL;
 	argc_test=3;
 	argv_known=(char **)realloc(argv_known, 7*sizeof(char **));


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




More information about the Commits mailing list