From: Craig Small Date: Mon, 19 Mar 2001 02:10:59 +0000 (+0000) Subject: added Davids suggestion for process name selection X-Git-Tag: psmisc-21~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f087919573fab64dc29a845991695515bf29ba5;p=psmisc added Davids suggestion for process name selection --- diff --git a/ChangeLog b/ChangeLog index c6b14a4..ef87d2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,8 @@ Changes from 19 to 20 (14-DEC-2000) - signames.h generated better (suggested by Grant Erickson) - uses getopt() for better command line stuff - makes less assumptions about process name, closes Debian Bug #53337 - - Doesn't use losetup for loop deivces in fuser. + - Doesn't use losetup for loop devices in fuser. + - Better selection of process name (thanks to David desJardins) Changes from version 18 to 19 (25-OCT-1999) ============================= diff --git a/src/killall.c b/src/killall.c index 8453678..bc25c07 100644 --- a/src/killall.c +++ b/src/killall.c @@ -154,8 +154,32 @@ kill_all (int signal, int names, char **namelist) sprintf (path, PROC_BASE "/%d/cmdline", pid_table[i]); if (!(file = fopen (path, "r"))) continue; - okay = fscanf (file, "%s", command_buf) == 1; - (void) fclose (file); + while (1) { + /* look for actual command so we skip over initial "sh" if any */ + char *p; + /* 'cmdline' has arguments separated by nulls */ + for (p=command_buf; p