git: caf5283fc92e - main - grep: Suppress EISDIR when reading.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Fri, 08 Sep 2023 18:21:28 UTC
The branch main has been updated by des:

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

commit caf5283fc92edb83173752b1dafbc6d586e78815
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-09-08 18:17:41 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-09-08 18:19:46 +0000

    grep: Suppress EISDIR when reading.
    
    MFC after:      1 week
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    Reviewed by:    kevans
---
 usr.bin/grep/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c
index cd2764811776..3349b72842ca 100644
--- a/usr.bin/grep/file.c
+++ b/usr.bin/grep/file.c
@@ -72,6 +72,8 @@ grep_refill(struct file *f)
 	bufrem = 0;
 
 	nr = read(f->fd, buffer, MAXBUFSIZ);
+	if (nr < 0 && errno == EISDIR)
+		nr = 0;
 	if (nr < 0)
 		return (-1);