From nobody Thu Jun 6 17:25:55 2024 X-Original-To: dev-commits-src-main@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 4VwB7S1ZGWz5NKcx; Thu, 06 Jun 2024 17:25:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VwB7S0tjbz4Mbb; Thu, 6 Jun 2024 17:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717694756; 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=R3f21IphXLSSe91ibVlRqcCSQkSUUWKL13FOfUdC8ag=; b=IVMBeE9zCYwsyFqS+T0QIq/SvQFx2OHOd3yFC92UPNQta6kEk55e+M1/E8zu6d5+t6pChV Zl9FfaVfH1GyqcG9uUGQwUP1SPK1qZr+23qDXMiCSL1xrjU9ynDNtlUxn33877GoIIlXu2 mjNyw3urO1SEY/2GGrqsQgW8Z4U+92T7aO2f4ZD+EfOQQyaFBKI8GWSAU0ewZ2IJBuULG0 KUqEX4y48/nIda4yrCfnf7MSqrlhQheOixWg0cV3pxhTMEIiRQv/MNpKRD7el/xV/WrhPy Yhgteim7TzBQVINUWoAgJuLOSZrFJ3o2B+pBKwCCDXslnM9wt91+nxv77hV9jw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717694756; a=rsa-sha256; cv=none; b=bvZvz7S4KYIQY7Jmh4S0LlhLahG6RI+WQLj263FN1hBmoj6XVyY1mjMUbp9cS+l0XWL4y0 H/pcFuJ5pbJlrCQhsgciQpq3LSBRPUOffscGJBIzItEicX+JbUxP4tesCEhlsMU8DX1Hrv 0GtzL7sXG6BhLWGROq9LJ/NunY0W+aTHTeZtGh34YHZ9QaR8tMxWjn/ePv8dZFMQSb1OYE l6h4cYF11AcT9sx4IuiFom1bqraE6eVkln6EMjr/YksvCZBbjw0G2WZp5Eol+djOnlpUGB wFAtV2lWlyAw22tgCcAYsA1Paq9rL/oF3qzA6opigoBsZUmJ1vJ3QuNCykfylQ== 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=1717694756; 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=R3f21IphXLSSe91ibVlRqcCSQkSUUWKL13FOfUdC8ag=; b=Yabj1G570yL7EmYBdiyBM8e48t2QyNMy5dHJGz6RUJ/EvTH8hs5QEtnPCY2rZgpI5p9/RL 1OwC8bBuFZSe7DxxmBuqXZ/nl8c6//4secEivoiobZKjvDgOhLm7M9IhFq0jpqA2OopHlU i5icM8tS0W9x6SkFNyyXZzk8TWtrfvfW2qU+6H4oex+YVa95xeuUUEAgnGFLFiqJ1q++Hu hyvz7m+GvQ2A3o4wMScOnuvrrFqjxVJmp+qNKzr2XruoJA+eD9ahpk6YOxbqdh1oUEJZI6 /EmoT/JO99PL0M0M+aKTLrxPVeve/zIpRe7t1e7clEV+4vVnacAcvd52wq8cOg== 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 4VwB7S0VG8zvv2; Thu, 6 Jun 2024 17:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456HPt18007411; Thu, 6 Jun 2024 17:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456HPtbM007408; Thu, 6 Jun 2024 17:25:55 GMT (envelope-from git) Date: Thu, 6 Jun 2024 17:25:55 GMT Message-Id: <202406061725.456HPtbM007408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 4472fd66d006 - main - lam: fail on I/O errors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4472fd66d0067347e3123896ae1b33f8bd444d56 Auto-Submitted: auto-generated The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=4472fd66d0067347e3123896ae1b33f8bd444d56 commit 4472fd66d0067347e3123896ae1b33f8bd444d56 Author: Cosimo Cecchi AuthorDate: 2024-06-06 17:24:07 +0000 Commit: Allan Jude CommitDate: 2024-06-06 17:24:15 +0000 lam: fail on I/O errors I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit changes lam to exit with EX_IOERR when an I/O error occurs. Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45437 --- usr.bin/lam/lam.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c index 68cb4b946575..2194ae7ab596 100644 --- a/usr.bin/lam/lam.c +++ b/usr.bin/lam/lam.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #define MAXOFILES 20 @@ -212,6 +213,9 @@ gatherline(struct openfile *ip) *p = '\0'; if (c == EOF) { ip->eof = 1; + if (ferror(ip->fp)) { + err(EX_IOERR, NULL); + } if (ip->fp == stdin) fclose(stdin); morefiles--;