summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f3e0909)
raw | patch | inline | side by side (parent: f3e0909)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Wed, 5 Nov 2008 16:15:59 +0000 (16:15 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Wed, 5 Nov 2008 16:15:59 +0000 (16:15 +0000) |
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.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2069 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2069 f882894a-f735-0410-b71e-b25c423dba1c
lib/extra_opts.c | patch | blob | history | |
lib/tests/test_opts.c | patch | blob | history |
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index b555417a834a4bf9cd1eb5e94042f4a846447899..7e50c178e02cdfce1a8651f4e8de180743234c87 100644 (file)
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
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 */
diff --git a/lib/tests/test_opts.c b/lib/tests/test_opts.c
index b9696dfbd2a9b432a8f3bd219f26863911678f15..6d6167ebf2061540c6dc1497e0a9d466f0fe4f4f 100644 (file)
--- a/lib/tests/test_opts.c
+++ b/lib/tests/test_opts.c
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@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 **));