From 82a33b3f060e163b14155e8f6833ec30514a609b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 1 Jul 2019 16:15:55 -0700 Subject: killall: better handling of long names. Change names_to_pid() so that we can actually match shell scripts with long names (the code to get the shell script's name was correct, but there was an extra test preventing us from actually comparing it to the sought name). In kill.c itself, remove a dead test for -l and switch to the FLAG() macro. Also extend the tests to explicitly cover long and short names. --- lib/lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index b488407e..e00278c5 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1093,7 +1093,7 @@ void names_to_pid(char **names, int (*callback)(pid_t pid, char *name)) cmd[len] = 0; } if (!strcmp(bb, getbasename(cmd))) goto match; - if (bb!=*cur && !strcmp(bb, getbasename(cmd+strlen(cmd)+1))) goto match; + if (!strcmp(bb, getbasename(cmd+strlen(cmd)+1))) goto match; continue; match: if (callback(u, *cur)) break; -- cgit v1.2.3