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] = "[email protected]";
+ 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.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
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.