Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-09-05 16:05:47 +0400
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-09-05 16:05:47 +0400
commita959a858a36fd88c1adc4ef5a05d621d555df63e (patch)
tree2373169d946b8f7ec3335128422e6d309a8b9ddf /procps
parent2957fc699207d8e855c7024f8f91c451cf018952 (diff)
- pull r22872 from trunk:
pidof/killall: allow find_pid_by_name to find running processes started as scripts_with_name_longer_than_15_bytes.sh closes bug 4054 (and is generally neat)
Diffstat (limited to 'procps')
-rw-r--r--procps/pgrep.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 336fa84ba..f08d6cc5f 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -111,8 +111,14 @@ int pgrep_main(int argc ATTRIBUTE_UNUSED, char **argv)
if (proc->pid == pid)
continue;
cmd = proc->argv0;
- if (!cmd)
+ if (!cmd) {
cmd = proc->comm;
+ } else {
+ int i = proc->argv_len;
+ while (i) {
+ if (!cmd[i]) cmd[i] = ' ';
+ i--;
+ }
/* NB: OPT_INVERT is always 0 or 1 */
if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
&& (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT