From a7b8b772dee4f159028e3b998454d7466fbbc88f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 11 Jul 2019 14:00:07 -0700 Subject: pidof: fix default behavior, add -x. Before this patch, we're effectively doing `pidof -x` all the time. This patch changes names_to_pid() to allow us to say whether or not we want to include scripts, and adjusts the callers appropriately. Also add tests for `pidof` versus `pidof -x` which pass after this patch, without regressing the existing killall tests. --- lib/lib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/lib.h') diff --git a/lib/lib.h b/lib/lib.h index e744977f..9c5e9a37 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -401,7 +401,8 @@ void mode_to_string(mode_t mode, char *buf); char *getdirname(char *name); char *getbasename(char *name); char *fileunderdir(char *file, char *dir); -void names_to_pid(char **names, int (*callback)(pid_t pid, char *name)); +void names_to_pid(char **names, int (*callback)(pid_t pid, char *name), + int scripts); pid_t __attribute__((returns_twice)) xvforkwrap(pid_t pid); #define XVFORK() xvforkwrap(vfork()) -- cgit v1.2.3