summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b5886d1)
raw | patch | inline | side by side (parent: b5886d1)
author | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Mon, 11 Jun 2007 20:54:07 +0000 (20:54 +0000) | ||
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Mon, 11 Jun 2007 20:54:07 +0000 (20:54 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1736 f882894a-f735-0410-b71e-b25c423dba1c
THANKS.in | patch | blob | history | |
plugins/popen.c | patch | blob | history |
diff --git a/THANKS.in b/THANKS.in
index baed6965ab21e4379231e2e2c4673dcb5c6723b0..f666248ebc4a9b5846eb1b817cfe0fd154dd5f8b 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Matthias Flacke
Emil Michles
Ask Bjoern Hansen
+Daniel Bimschas
diff --git a/plugins/popen.c b/plugins/popen.c
index 80a7119b983cc711452a3524f77417e1434c8b58..a7e6f9b2f238c202297c95256f5287f530e47059 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
char *env[2];
char *cmd = NULL;
char **argv = NULL;
- char *str;
+ char *str, *tmp;
int argc;
int i = 0, pfd[2], pfderr[2];
cmd = 1 + strstr (str, "'");
str[strcspn (str, "'")] = 0;
}
- else {
+ else if (strcspn(str,"'") < strcspn (str, " \t\r\n")) {
+ /* handle --option='foo bar' strings */
+ tmp = str + strcspn(str, "'") + 1;
+ if (!strstr (tmp, "'"))
+ return NULL; /* balanced? */
+ tmp += strcspn(tmp,"'") + 1;
+ *tmp = 0;
+ cmd = tmp + 1;
+ } else {
if (strpbrk (str, " \t\r\n")) {
cmd = 1 + strpbrk (str, " \t\r\n");
str[strcspn (str, " \t\r\n")] = 0;
cmd = NULL;
argv[i++] = str;
+ printf("arg no.%i: %s\n",i,str);
}
argv[i] = NULL;