Bug 10086 - The pgrep can't match the comm property of a process, which pidof can do.
Summary: The pgrep can't match the comm property of a process, which pidof can do.
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-17 09:13 UTC by wumingyuan
Modified: 2017-07-21 15:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wumingyuan 2017-07-17 09:13:03 UTC
Hello,
  The pgrep can't match the comm property of a process, which pidof can do.
  Here is my patch. thanks for your BusyBox.

1 153c153 
2 < char *cmd; 
3 --- 
4 > char *cmd, *comm; 
5 159,161c159,160 
6 < if (!cmd) { 
7 < cmd = proc->comm; 
8 < } else { 
9 --- 
10 > comm = proc->comm; 
11 > if (cmd) { 
12 176c175,176 
13 < || (regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ 
14 --- 
15 > || (((cmd && regexec(&re_buffer, cmd, 1, re_match, 0) == 0) 
16 > || regexec(&re_buffer, comm, 1, re_match, 0) == 0) /* match found */
Comment 1 Denys Vlasenko 2017-07-21 15:44:51 UTC
Fixed in git, thanks!