git: 00ad40d70a67 - main - throw an error if reading from stdin failed

From: Wolfram Schneider <wosch_at_FreeBSD.org>
Date: Mon, 31 Jan 2022 18:11:46 UTC
The branch main has been updated by wosch:

URL: https://cgit.FreeBSD.org/src/commit/?id=00ad40d70a67f0dd8c18d30ff3d0290f924b2ac8

commit 00ad40d70a67f0dd8c18d30ff3d0290f924b2ac8
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2022-01-31 18:04:45 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2022-01-31 18:04:45 +0000

    throw an error if reading from stdin failed
---
 usr.bin/locate/bigram/locate.bigram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr.bin/locate/bigram/locate.bigram.c b/usr.bin/locate/bigram/locate.bigram.c
index a654448680a3..c6b2d921fdf0 100644
--- a/usr.bin/locate/bigram/locate.bigram.c
+++ b/usr.bin/locate/bigram/locate.bigram.c
@@ -103,6 +103,9 @@ main(void)
 			oldpath = buf2;
 		}
    	}
+	if (!feof(stdin) || ferror(stdin))
+		err(1, "stdin");
+
 
 	/* output, boundary check */
 	for (i = ASCII_MIN; i <= ASCII_MAX; i++)