From nobody Wed Jun 3 20:50:44 2026 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 4gW0GL0FS0z6ghWH for ; Wed, 03 Jun 2026 20:50:50 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gW0GK6hXzz3NsJ for ; Wed, 03 Jun 2026 20:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780519849; 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=Q2lE3fHUz3zTgvBSPJZ3ffncw7USRcSgM601ZJF+B0I=; b=JFcqifKLQ1+WNpzJDig+dSNlleGOI754DYIJrXBOyEnP9p4UKms9pazY5sbTW5cVEqdaAw 9g8ridJRSpLcNg1rGrZXi/JgcY+DNCq+g8eYZsNLyKEFdy4wga9f+rRSibbxXiBfiHZWZy bmHkjR6R5Mz5KRMAElwOgteTfTBOTwo32rtdtZuRRDNuu+SNSlanePAqcux1lz92xzRLAp YqUIRm01imTlrOj4Y7i8DrFADAieEQoN0Y2xU3VX4ZGvz6rqw+VYIJqm/g4r6UEBGuBTrf pok8w2qFHI7tuo9jqEF+78J1FfSqWtGsIIdA3N7WG9pqMCTkxpq5Xw0GTuY1MQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780519849; a=rsa-sha256; cv=none; b=pirGdfFJlh9G1E9BVOEo7UaRu0iZR5db+iX76eIKvRe17UO2nOZMVcq7qx2RKipmc3Fdig VJcnwY+dnIZTRwsNhNA7UPnQwRROdLy6dY12B2wkAMQqwOW8PbwMi53ehJ9NQ+GIyMe9AA iJB4gajCLETbwPm8STNtXEQZWHHUqT+K7kliz+dn0mu1N5JmmO2nl1pv3RWq3iHPfE1ZHm kJKznvrN+gt1bpw/Qd4mX5YETC/krRT7ZXX7/cAUEBxDHnbh4kV8SsJAxiIVv0Q+R+76zS rmAqIM8sfh7vRNuAOJm4yIF1hZ+z0cadLBSwfo1V/DVqmZsX6W7Sejq/8tDQAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780519849; 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=Q2lE3fHUz3zTgvBSPJZ3ffncw7USRcSgM601ZJF+B0I=; b=ZTdz/2cdf3TsBFaD8YsV0VuScJ8fEehvEyMrvbsLIGuCnUljtxZG6w2f4e7O4XGlYr1aCp ZD/iffOPtZKAGcCfU4HGLlk4p6ZjXfF5oUYKU2U/iCJ8BuW+a4Qw5OSd1UiXxSeqGXbPc4 NiX/Lw2yqSeW74scKL/dBflfj7IX2ixqnIbYgDYXv0blnlOXRB0t5qe5uv9J7k3XTNvVyF k9YBec63Qv/h1+tnZ2i2hZl8+WbdZM//vQkYsYSDptpebUx4iM6EgbwHlt5T72ATJ80cZb gUNlxv10U0WIs6PiaFXl/Fjv9juaF3uU84BZlyQ+1JlOTXQERfJpd3CNeP1+ew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gW0GK60gtzBqb for ; Wed, 03 Jun 2026 20:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b045 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 03 Jun 2026 20:50:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jilles Tjoelker Subject: git: 8bf490256986 - main - diff: Correct fd 0 case on pipe 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jilles X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bf4902569869133affd91bdcb71b74656cfc36e Auto-Submitted: auto-generated Date: Wed, 03 Jun 2026 20:50:44 +0000 Message-Id: <6a2093a4.3b045.4175e932@gitrepo.freebsd.org> The branch main has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=8bf4902569869133affd91bdcb71b74656cfc36e commit 8bf4902569869133affd91bdcb71b74656cfc36e Author: Jilles Tjoelker AuthorDate: 2026-06-03 20:42:01 +0000 Commit: Jilles Tjoelker CommitDate: 2026-06-03 20:50:38 +0000 diff: Correct fd 0 case on pipe After git commit c8d40bf8ecc60cc15e3904410db62065ea681fdc, if fd 0 was not open, it is left with CLOEXEC set and therefore fails. This is an unlikely situation, but fixing it reduces the size of the code (by using posix_spawn_file_actions_adddup2's special case if the two file descriptor numbers are the same). At the same time, check the error code from posix_spawn_file_actions_adddup2. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D56910 --- usr.bin/diff/pr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/diff/pr.c b/usr.bin/diff/pr.c index e8a4162d8b18..57cbb6a56ce5 100644 --- a/usr.bin/diff/pr.c +++ b/usr.bin/diff/pr.c @@ -71,8 +71,9 @@ start_pr(char *file1, char *file2) posix_spawnattr_setprocdescp_np(&sa, &pr->procd, 0); - if (pfd[0] != STDIN_FILENO) - posix_spawn_file_actions_adddup2(&fa, pfd[0], STDIN_FILENO); + error = posix_spawn_file_actions_adddup2(&fa, pfd[0], STDIN_FILENO); + if (error != 0) + errc(2, error, "posix_spawn_file_actions_adddup2"); char *argv[] = { __DECONST(char *, _PATH_PR), __DECONST(char *, "-h"), header, NULL };