aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/grep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/grep.c b/toys/posix/grep.c
index cd8928a1..52d10139 100644
--- a/toys/posix/grep.c
+++ b/toys/posix/grep.c
@@ -154,7 +154,7 @@ static void do_grep(int fd, char *name)
lcount++;
errno = 0;
ulen = len = getdelim(&line, &ulen, TT.indelim, file);
- if (errno) perror_msg("%s", name);
+ if (len == -1 && errno) perror_msg("%s", name);
if (len<1) break;
if (line[ulen-1] == TT.indelim) line[--ulen] = 0;