← Commit list

3a0eea088

Denys Vlasenko
Denys Vlasenko
2019-06-15
SUCCESS Duration: 152s

Subject

pidof: support "pidof /path/to/binary" case

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/find_pid_by_name.c+5 -1
@@ -90,7 +90,11 @@ pid_t* FAST_FUNC find_pid_by_name(const char *procName)
/* 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;