diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index e4251215abf467102972e36723fa133386932a47..8c17fa4ae37eb07f187f671d1c37f27e47ffdb59 100644 (file)
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
/* FIXME: copied from utils.h; we should move a bunch of libs! */
int
/* FIXME: copied from utils.h; we should move a bunch of libs! */
int
-is_option (char *str)
+is_option2 (char *str)
{
if (!str)
return 0;
{
if (!str)
return 0;
i--;
*argc-=1;
}else if(strcmp(argv[i], "--extra-opts")==0){
i--;
*argc-=1;
}else if(strcmp(argv[i], "--extra-opts")==0){
- if(!is_option(argv[i+1])){
+ if((i+1<*argc)&&!is_option2(argv[i+1])){
/* It is a argument with separate value */
argptr=argv[i+1];
/* Delete the extra-opts argument/value */
/* It is a argument with separate value */
argptr=argv[i+1];
/* Delete the extra-opts argument/value */
if(argv_new==NULL) die(STATE_UNKNOWN, _("malloc() failed!\n"));
/* starting with program name */
if(argv_new==NULL) die(STATE_UNKNOWN, _("malloc() failed!\n"));
/* starting with program name */
- argv_new[0]=strdup(argv[0]);
+ argv_new[0]=argv[0];
argc_new=1;
/* then parsed ini opts (frying them up in the same run) */
while(extra_args){
argc_new=1;
/* then parsed ini opts (frying them up in the same run) */
while(extra_args){
free(ea1);
}
/* finally the rest of the argv array */
free(ea1);
}
/* finally the rest of the argv array */
- for (i=1; i<*argc; i++) argv_new[argc_new++]=strdup(argv[i]);
+ for (i=1; i<*argc; i++) argv_new[argc_new++]=argv[i];
*argc=argc_new;
/* and terminate. */
argv_new[argc_new]=NULL;
*argc=argc_new;
/* and terminate. */
argv_new[argc_new]=NULL;