From nobody Mon Jun 9 23:53:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bGTJZ5zFQz5yhGn; Mon, 09 Jun 2025 23:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bGTJZ2zfrz3KLx; Mon, 09 Jun 2025 23:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749513198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGnxa9W/SdTwyOXTHFSQMzxm8Wx6tqnXcNQD7cpsZfI=; b=QRe4lW6P17bByyBb7QVDj7p/caYcAWap7paBjuaVnDd2lZ5MzORIUXllwBftIfXHZ9L93Y f8WJtOy0u+UUqacasZzSEaDTLC/GKpV8bs1e7aZwcbnLpLNO8X3twtw5O/78rdhXmBOtdb jun/7azZNoyPdTLzPhzfvdGhj22tVOVSK8OvzzQmxZuVbSjuSBUR10KTGs9gSP609Iqulx JsWmQDPoyfB/vKb9ZkpDMhL64ndfzS+8ytcw8g1HBQjT4lWmTjCErjnUjqYtS73R3iGxOY xjJglK5RnaRgUN5E+rFfltrSXqNer2fTXhVycBTwtV/iOnXqkMqr8+jXEz9j/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749513198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGnxa9W/SdTwyOXTHFSQMzxm8Wx6tqnXcNQD7cpsZfI=; b=wqI5hVE+7KzlJHhAyMkseRkXfuQxhR80fdQMDTqovg3QeftF96zYm7BXFQw+MjfTAhEEZR S7TILx7gjIqGfMD1YHcSWrNqT93QNsE6AOyoBNxM5hKTzq8AvgRehxSHbK/rTeIo26687x aGbLvVRLERqK3aC5A9eOwXXS14j7Mow6F9iz+uyUb1QGRX7Aa0tvcuKx7HA6CcO8kEVEcB cJtWfL9vbsFwYha4Na/J5SKpN+Cz7MYmDxN+NlPEPsN8yrjyS24G+6+gXWX9CfqifNJ+Dm X4ZqGBvBkDfMno+aQmGtEBfDXEBy4R4IYCZcEgSPFaheIcKLMw6I8CoSFVDqdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749513198; a=rsa-sha256; cv=none; b=C0e9HYZAj/10IsnBjG18yV58sb7ZiQkiMSKI8Hjnz0PbXOGBwGaDaT/NfvostB2z0+gXL3 S0w8s50gX35M4doXKqU+wf2CWcfvL7ZLvPXyz36v/FAwNRWn66j357r0RBb/g5nq7z4RMy diGB0CvnFOddO564j0UM1g5RRmdgHYiGqIwljFMnOw7Dc25YUHmYRFFKCW+nl8PSzmwMHk EMQo/38WaIEwQCtmZivzbDfUtaVCZLQjTkeWRROgJrye+IhqSMi5EohatkJhHF8NK1MncA KXEcx/5BeJINp4peeWvSZlHCXck/mqlHAGCmHysmS5OCeIOubJqz+PDnwK3w+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bGTJZ2N7yz1wh; Mon, 09 Jun 2025 23:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 559NrIrX006760; Mon, 9 Jun 2025 23:53:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 559NrIWv006757; Mon, 9 Jun 2025 23:53:18 GMT (envelope-from git) Date: Mon, 9 Jun 2025 23:53:18 GMT Message-Id: <202506092353.559NrIWv006757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 15e4b8d5ef84 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 15e4b8d5ef845066819c4cbb5d03b63148688298 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=15e4b8d5ef845066819c4cbb5d03b63148688298 commit 15e4b8d5ef845066819c4cbb5d03b63148688298 Author: Konstantin Belousov AuthorDate: 2025-06-07 11:24:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-09 23:51:06 +0000 timeout(1): silence warnings for ESRCH It is possible for the child to become zombie and then there is nothing to signal. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752 --- 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",