summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a7b252)
raw | patch | inline | side by side (parent: 8a7b252)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Tue, 1 Apr 2008 09:31:27 +0000 (09:31 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Tue, 1 Apr 2008 09:31:27 +0000 (09:31 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1971 f882894a-f735-0410-b71e-b25c423dba1c
lib/extra_opts.c | patch | blob | history | |
lib/extra_opts.h | patch | blob | history |
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index d46d124f494a53d216ad680e0002d5a15a37f5cb..8c17fa4ae37eb07f187f671d1c37f27e47ffdb59 100644 (file)
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
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){
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;
diff --git a/lib/extra_opts.h b/lib/extra_opts.h
index 8ce09036fa509f33eb8153ddc73b67c7e9731a6b..0cb47fb1c148094e436729afbb451e9af2ae6bba 100644 (file)
--- a/lib/extra_opts.h
+++ b/lib/extra_opts.h
* ini-procesed arguments always come first (in the ord of --extra-opts
* arguments). If no --extra-opts arguments are provided or returned nothing
* it returns **argv otherwise the new array is returned. --extra-opts are
- * always removed from **argv and the new array and all its elements can be
- * freed with free();
+ * always removed from **argv. The original pointers from **argv are kept in
+ * the new array to preserve ability to overwrite arguments in processlist.
*/
char **np_extra_opts(int *argc, char **argv, const char *plugin_name);