summaryrefslogtreecommitdiffstats
path: root/lib/extra_opts.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-05 16:15:59 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-05 16:15:59 +0000
commit3011838fe9796f24ad3d197057890042b527ef9d (patch)
treef096a06be5c65e49c46ee0c85c591cda08383a50 /lib/extra_opts.c
parentf3e0909e124674db029dbfbfb4ae80de94a5d89f (diff)
downloadmonitoring-plugins-3011838fe9796f24ad3d197057890042b527ef9d.tar.gz
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. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2069 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/extra_opts.c')
-rw-r--r--lib/extra_opts.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index b555417a..7e50c178 100644
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
@@ -103,14 +103,13 @@ char **np_extra_opts(int *argc, char **argv, const char *plugin_name){
103 ea_tmp=extra_args; 103 ea_tmp=extra_args;
104 while(ea_tmp->next) { 104 while(ea_tmp->next) {
105 ea_tmp=ea_tmp->next; 105 ea_tmp=ea_tmp->next;
106 ea_num++;
107 } 106 }
108 ea_tmp->next=ea1; 107 ea_tmp->next=ea1;
108 while(ea1=ea1->next) ea_num++;
109 } 109 }
110 ea1=ea_tmp=NULL; 110 ea1=ea_tmp=NULL;
111 } 111 }
112 /* lather, rince, repeat */ 112 } /* lather, rince, repeat */
113 }
114 113
115 if(ea_num==*argc && extra_args==NULL){ 114 if(ea_num==*argc && extra_args==NULL){
116 /* No extra-opts */ 115 /* No extra-opts */