diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 19:23:22 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 19:23:22 +0100 |
| commit | f9d98f594a2b5103f0e88bf33191ad164a77c239 (patch) | |
| tree | 59edafbb544aef35be63dadf09e6e448e27afc6d /src/Daemon/MiddleWare.cpp | |
| parent | b634e1a482f6871bb4e128f3bc23456f09f85547 (diff) | |
| parent | baacc3cadfd08293e6f46bd84ab322d0cb67bf10 (diff) | |
Merge branch 'master' into rhel6
Diffstat (limited to 'src/Daemon/MiddleWare.cpp')
| -rw-r--r-- | src/Daemon/MiddleWare.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 2786938..c3f9061 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -566,13 +566,19 @@ void LoadOpenGPGPublicKey(const char* key) static char *get_argv1_if_full_path(const char* cmdline) { char *argv1 = (char*) strchr(cmdline, ' '); - if (argv1 != NULL) + while (argv1 != NULL) { /* we found space in cmdline, so it might contain * path to some script like: - * /usr/bin/python /usr/bin/system-control-network + * /usr/bin/python [-XXX] /usr/bin/system-control-network */ argv1++; + if (*argv1 == '-') + { + /* looks like -XXX in "perl -XXX /usr/bin/script.pl", skip */ + argv1 = strchr(argv1, ' '); + continue; + } /* if the string following the space doesn't start * with '/' it's probably not a full path to script * and we can't use it to determine the package name @@ -584,6 +590,7 @@ static char *get_argv1_if_full_path(const char* cmdline) int len = strchrnul(argv1, ' ') - argv1; /* cut the cmdline arguments */ argv1 = xstrndup(argv1, len); + break; } return argv1; } |
