aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-06-15 18:35:39 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-06-15 18:35:39 +0200
commit3a0eea0887d72f28d13d329be90fe4082cbbd427 (patch)
tree13e78e527233cca6fd6024f3418d983ae6b812ee
parent070aa6174728d35077d98e875717358ccfbf2870 (diff)
downloadbusybox-w32-3a0eea0887d72f28d13d329be90fe4082cbbd427.tar.gz
busybox-w32-3a0eea0887d72f28d13d329be90fe4082cbbd427.tar.bz2
busybox-w32-3a0eea0887d72f28d13d329be90fe4082cbbd427.zip
pidof: support "pidof /path/to/binary" case
function old new delta find_pid_by_name 230 227 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/find_pid_by_name.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c
index abbf293e8..fe13f7211 100644
--- a/libbb/find_pid_by_name.c
+++ b/libbb/find_pid_by_name.c
@@ -90,7 +90,11 @@ pid_t* FAST_FUNC find_pid_by_name(const char *procName)
90 /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/ 90 /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/
91 || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0) 91 || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0)
92 /* or we require /proc/PID/exe link to match */ 92 /* or we require /proc/PID/exe link to match */
93 || (p->exe && strcmp(bb_basename(p->exe), procName) == 0) 93 || (p->exe && strcmp(
94 procName[0] == '/' ? p->exe /* support "pidof /path/to/binary" case too */
95 : bb_basename(p->exe),
96 procName
97 ) == 0)
94 ) { 98 ) {
95 pidList = xrealloc_vector(pidList, 2, i); 99 pidList = xrealloc_vector(pidList, 2, i);
96 pidList[i++] = p->pid; 100 pidList[i++] = p->pid;