From d89cf4447071f8a2b6b95802680cd0c6ff467ec7 Mon Sep 17 00:00:00 2001 From: albert <> Date: Tue, 19 Oct 2004 18:04:31 +0000 Subject: [PATCH] pkill should be quiet about processes that have gone away --- NEWS | 1 + pgrep.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 865f6109..6e67b3c8 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ pwdx: new command -- thanks Nicholas Miell ps: more room for some columns watch: passes COLUMNS and LINES in environment top: in batch mode, tolerate unknown $TERM -- thanks Daniel Walsh +pkill: quiet about processes that die before kill() procps-3.2.2 --> procps-3.2.3 diff --git a/pgrep.c b/pgrep.c index 681b9626..cf6ced95 100644 --- a/pgrep.c +++ b/pgrep.c @@ -614,9 +614,10 @@ main (int argc, char **argv) if (i_am_pkill) { int i; for (i = 1; i <= procs[0].num; i++) { - if (kill (procs[i].num, opt_signal) == -1) - fprintf (stderr, "pkill: %ld - %s\n", - procs[i].num, strerror (errno)); + if (kill (procs[i].num, opt_signal) != -1) continue; + if (errno==ESRCH) continue; // gone now, which is OK + fprintf (stderr, "pkill: %ld - %s\n", + procs[i].num, strerror (errno)); } } else { if (opt_long)