diff options
Diffstat (limited to 'procps/pgrep.c')
| -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 04ae92a67..299e2dac7 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -215,16 +215,16 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv) if (!match) { again: match = (regexec(&re_buffer, cmd, 1, re_match, 0) == 0); + if (match && OPT_ANCHOR) { + /* -x requires full string match */ + match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0'); + } if (!match && cmd != proc->comm) { /* if argv[] did not match, try comm */ cmdlen = -1; cmd = proc->comm; goto again; } - if (match && OPT_ANCHOR) { - /* -x requires full string match */ - match = (re_match[0].rm_so == 0 && cmd[re_match[0].rm_eo] == '\0'); - } } /* NB: OPT_INVERT is always 0 or 1 */ |
