git: 03f654e953f3 - stable/13 - grep: Suppress EISDIR when reading.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 14 Sep 2023 15:00:36 UTC
The branch stable/13 has been updated by des:

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

commit 03f654e953f3f1e1e0e7765318a05e36492bd163
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-14 14:59:52 +0000

    grep: Suppress EISDIR when reading.
    
    MFC after:      1 week
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    Reviewed by:    kevans
    
    (cherry picked from commit caf5283fc92edb83173752b1dafbc6d586e78815)
---
 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 2845f0ec225d..804d75b82484 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);