From nobody Sun Jan 30 13:09:22 2022 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 E4BFF198D8F8; Sun, 30 Jan 2022 13:09:22 +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 4Jms3Q4n5Fz4hQL; Sun, 30 Jan 2022 13:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643548162; 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=eulZgyqWEw8GVlR3fu9pCLanizPmuxM6p9YgyFNNWq0=; b=iCErIHq+5FFqj/dNfeDQnDdoEabMiIMbx+yGTvrYL9acNFrBRsYL39316AhK3QPSmssvic R5dEp5+Vs7fZ15hnbukiqFNixaeYC6ALRvnY3pEsEQMIslba3p91c09uj91LJETDJQNblv zApXII3tdNroUGfbqH6upcu4JrcnatPWfmY9GN4PjE/PnAbrB3QluYuGf1SzcyLSwq/yRY N9/xAPOTWifc4UYa68hMN63A0pN2HF5uukbCCg5qXdujIOXfGMS32Id65YR9mY3R377KZp xNRr19ERAzKkRySo16kMrHa3cmMGtni4Eq5cMDkRtq/P+KxzOUlzk0VAxwigSA== 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 8226714D0; Sun, 30 Jan 2022 13:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20UD9MDX015877; Sun, 30 Jan 2022 13:09:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20UD9MPX015876; Sun, 30 Jan 2022 13:09:22 GMT (envelope-from git) Date: Sun, 30 Jan 2022 13:09:22 GMT Message-Id: <202201301309.20UD9MPX015876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: 8e7c0a6d32c4 - main - fix fgets error handling (from last commit) 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e7c0a6d32c45ebad5bda14be0b8f03a43361743 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643548162; 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=eulZgyqWEw8GVlR3fu9pCLanizPmuxM6p9YgyFNNWq0=; b=LHE+C/NrWa7ZrgaNMQ5oukFYNHOo4qDdv8I55+Q8BHZZ7rZVhwSGunV4z8atDRE0hGCiol JR0nxO/H+iSFQSUD9Yg75ZG3eZRhndnlicfhpgtim3ZpDxM8nAqM5dSHjFTvuz+oNPF+HH gPYrIJyCF2v9vMmG25K8QcFe5JGf+Bgkdo18A9cFI65b+3sd6RnAkisHDx7l0MXyc9PnTX hEZzI0uZIbqqMTWWvCdlw1zzr5KWVIsohfCrpYD8ntcA87pyZb7aFEDbw5StK6eWzmOxGN gx3dUrGjxDOQsrX0QmBuaMyeZ9kpx0FQVbEX9lhMk+jB/1us1oPZEv3bBBJyPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643548162; a=rsa-sha256; cv=none; b=eLhizsxvEXh0FKfQdlU4eM0nxli3EAE829tH0WL9zaaBHWdbUE0JD8VyM8Y8yZtzB40HBr 2Tz/lgnkcForTiBbfrZrr6nFM6+y4bHRuH7VZne9IckT3dx0r7fOfIAgwf+zXGYSVJhTqC Gp/Wt/gb42og8gVsZlUl4fmZ0hpnpBA30YfMmZ9nCcxXJDxOtCa18c0TO8D7oxvwPZRnVt wb2RyEKFu2nUpKk6xkGmAlbLpx6ouuizUVLDglYhR09kQXgFTNOWwBRBhvJqMrfnPq9eVb apIwt15ek2KcsqR2QWy5i3DqiiVHS4qtvCAxn8onUeAg/WtNomw7KhQQqBdIKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=8e7c0a6d32c45ebad5bda14be0b8f03a43361743 commit 8e7c0a6d32c45ebad5bda14be0b8f03a43361743 Author: Wolfram Schneider AuthorDate: 2022-01-30 13:08:42 +0000 Commit: Wolfram Schneider CommitDate: 2022-01-30 13:08:42 +0000 fix fgets error handling (from last commit) --- usr.bin/locate/code/locate.code.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/locate/code/locate.code.c b/usr.bin/locate/code/locate.code.c index 23fa043b12af..9da78d55e622 100644 --- a/usr.bin/locate/code/locate.code.c +++ b/usr.bin/locate/code/locate.code.c @@ -144,8 +144,10 @@ main(int argc, char *argv[]) err(1, "%s", argv[0]); /* First copy bigram array to stdout. */ - if (fgets(bigrams, BGBUFSIZE + 1, fp) == NULL) - err(1, "get bigram array"); + if (fgets(bigrams, BGBUFSIZE + 1, fp) == NULL) { + if (!feof(fp) || ferror(fp)) + err(1, "get bigram array"); + } if (fwrite(bigrams, 1, BGBUFSIZE, stdout) != BGBUFSIZE) err(1, "stdout");