diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_procs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 3671559..737a87b 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -80,7 +80,7 @@ Optional Filters:\n\ | |||
80 | -u, --user=USER\n\ | 80 | -u, --user=USER\n\ |
81 | Only scan for processes with user name or ID indicated.\n\ | 81 | Only scan for processes with user name or ID indicated.\n\ |
82 | -a, --argument-array=STRING\n\ | 82 | -a, --argument-array=STRING\n\ |
83 | Only scan for ARGS that match up to the length of the given STRING.\n\ | 83 | Only scan for processes with args that contain STRING.\n\ |
84 | -C, --command=COMMAND\n\ | 84 | -C, --command=COMMAND\n\ |
85 | Only scan for exact matches to the named COMMAND.\n\ | 85 | Only scan for exact matches to the named COMMAND.\n\ |
86 | \n\ | 86 | \n\ |
@@ -206,14 +206,13 @@ main (int argc, char **argv) | |||
206 | cols = 7; | 206 | cols = 7; |
207 | } | 207 | } |
208 | if ( cols >= 7 ) { | 208 | if ( cols >= 7 ) { |
209 | found++; | ||
210 | resultsum = 0; | 209 | resultsum = 0; |
211 | asprintf (&procargs, "%s", input_buffer + pos); | 210 | asprintf (&procargs, "%s", input_buffer + pos); |
212 | strip (procargs); | 211 | strip (procargs); |
213 | 212 | ||
214 | if ((options & STAT) && (strstr (statopts, procstat))) | 213 | if ((options & STAT) && (strstr (statopts, procstat))) |
215 | resultsum |= STAT; | 214 | resultsum |= STAT; |
216 | if ((options & ARGS) && procargs && (strstr (procargs, args) == procargs)) | 215 | if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL)) |
217 | resultsum |= ARGS; | 216 | resultsum |= ARGS; |
218 | if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0)) | 217 | if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0)) |
219 | resultsum |= PROG; | 218 | resultsum |= PROG; |
@@ -233,6 +232,12 @@ main (int argc, char **argv) | |||
233 | procs, procuid, procvsz, procrss, | 232 | procs, procuid, procvsz, procrss, |
234 | procppid, procpcpu, procstat, procprog, procargs); | 233 | procppid, procpcpu, procstat, procprog, procargs); |
235 | 234 | ||
235 | /* Ignore self */ | ||
236 | if (strcmp (procprog, progname) == 0) | ||
237 | continue; | ||
238 | |||
239 | found++; | ||
240 | |||
236 | /* Next line if filters not matched */ | 241 | /* Next line if filters not matched */ |
237 | if (!(options == resultsum || options == ALL)) | 242 | if (!(options == resultsum || options == ALL)) |
238 | continue; | 243 | continue; |