diff options
Diffstat (limited to 'procps/kill.c')
-rw-r--r-- | procps/kill.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/procps/kill.c b/procps/kill.c index 260f4a0..c6dc79f 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -224,12 +224,18 @@ extern int kill_main(int argc, char **argv) else { /* Looks like they want to do a killall. Do that */ while (--argc >= 0) { - int pid; - - while((pid = findPidByName( *argv))) { - if (kill(pid, sig) != 0) - fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno)); + pid_t* pidList; + + pidList = findPidByName( *argv); + for(; pidList && pidList!=0; pidList++) { + if (kill(*pidList, sig) != 0) + fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); + else + errorMsg( "killed pid '%d'\n", *pidList); } + /* Note that we don't bother to free the memory + * allocated in findPidByName(). It will be freed + * upon exit, so we can save a byte or two */ argv++; } } |