Bug 10086

Summary: The pgrep can't match the comm property of a process, which pidof can do.
Product: Busybox Reporter: wumingyuan <wmy_ld>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

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!