[hackers] [ubase] pidof: match on full name and basename || Hiltjo Posthuma
commit 5a06a9f7e1fa161563d285cb7caf0ae8f530ab7c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat Jul 5 12:50:18 2014 +0000
pidof: match on full name and basename
busybox doesn't do this, but procps does.
diff --git a/pidof.c b/pidof.c
index 5841ed5..c921117 100644
--- a/pidof.c
+++ b/pidof.c
_AT_@ -33,7 +33,7 @@ main(int argc, char *argv[])
struct dirent *entry;
pid_t pid;
struct procstat ps;
- char cmdline[BUFSIZ], *cmd, *p, *arg = NULL;
+ char cmdline[BUFSIZ], *cmd, *cmdbase = NULL, *p, *arg = NULL;
int i, found = 0;
int sflag = 0, oflag = 0;
struct pidentry *pe, *tmp;
_AT_@ -83,16 +83,19 @@ main(int argc, char *argv[])
if (parsecmdline(ps.pid, cmdline,
sizeof(cmdline)) < 0) {
cmd = ps.comm;
+ cmdbase = cmd;
} else {
if ((p = strchr(cmdline, ' ')))
*p = '
Received on Sat Jul 05 2014 - 13:00:22 CEST
This archive was generated by hypermail 2.3.0
: Sat Jul 05 2014 - 13:12:08 CEST