diff options
Diffstat (limited to '')
| -rw-r--r-- | procps/pgrep.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/procps/pgrep.c b/procps/pgrep.c index 9773a72c4..adbdd08b7 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c | |||
| @@ -270,16 +270,16 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv) | |||
| 270 | if (!match) { | 270 | if (!match) { |
| 271 | again: | 271 | again: |
| 272 | match = (regexec(&re_buffer, cmd, 1, re_match, 0) == 0); | 272 | match = (regexec(&re_buffer, cmd, 1, re_match, 0) == 0); |
| 273 | if (match && OPT_ANCHOR) { | ||
| 274 | /* -x requires full string match */ | ||
| 275 | match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0'); | ||
| 276 | } | ||
| 273 | if (!match && cmd != proc->comm) { | 277 | if (!match && cmd != proc->comm) { |
| 274 | /* if argv[] did not match, try comm */ | 278 | /* if argv[] did not match, try comm */ |
| 275 | cmdlen = -1; | 279 | cmdlen = -1; |
| 276 | cmd = proc->comm; | 280 | cmd = proc->comm; |
| 277 | goto again; | 281 | goto again; |
| 278 | } | 282 | } |
| 279 | if (match && OPT_ANCHOR) { | ||
| 280 | /* -x requires full string match */ | ||
| 281 | match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0'); | ||
| 282 | } | ||
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | /* NB: OPT_INVERT is always 0 or 1 */ | 285 | /* NB: OPT_INVERT is always 0 or 1 */ |
