function old new delta
find_pid_by_name 230 227 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
/* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/
|| (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0)
/* or we require /proc/PID/exe link to match */
- || (p->exe && strcmp(bb_basename(p->exe), procName) == 0)
+ || (p->exe && strcmp(
+ procName[0] == '/' ? p->exe /* support "pidof /path/to/binary" case too */
+ : bb_basename(p->exe),
+ procName
+ ) == 0)
) {
pidList = xrealloc_vector(pidList, 2, i);
pidList[i++] = p->pid;