by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sBgb043553; Mon, 16 Jun 2025 08:54:11 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:11 GMT Message-Id: <202506160854.55G8sBgb043553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c55fd0184a17 - stable/14 - timeout(1): silence warnings for ESRCH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c55fd0184a17d2cb56884e6e2a15e70ad503ff76 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c55fd0184a17d2cb56884e6e2a15e70ad503ff76 commit c55fd0184a17d2cb56884e6e2a15e70ad503ff76 Author: Konstantin Belousov AuthorDate: 2025-06-07 11:24:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:54 +0000 timeout(1): silence warnings for ESRCH (cherry picked from commit 15e4b8d5ef845066819c4cbb5d03b63148688298) --- bin/timeout/timeout.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index e9c4e22fc7d3..424e72dac9ad 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -188,16 +188,23 @@ static void send_sig(pid_t pid, int signo, bool foreground) { struct procctl_reaper_kill rk; + int error; logv("sending signal %s(%d) to command '%s'", sys_signame[signo], signo, command); if (foreground) { - if (kill(pid, signo) == -1) - warnx("kill(%d, %s)", (int)pid, sys_signame[signo]); + if (kill(pid, signo) == -1) { + if (errno != ESRCH) + warnx("kill(%d, %s)", (int)pid, + sys_signame[signo]); + } } else { memset(&rk, 0, sizeof(rk)); rk.rk_sig = signo; - if (procctl(P_PID, getpid(), PROC_REAP_KILL, &rk) == -1) + error = procctl(P_PID, getpid(), PROC_REAP_KILL, &rk); + if (error == 0 || (error == -1 && errno == ESRCH)) + ; + else if (error == -1) warnx("procctl(PROC_REAP_KILL)"); else if (rk.rk_fpid > 0) warnx("failed to signal some processes: first pid=%d",