diff options
| author | Rob Landley <rob@landley.net> | 2017-06-11 12:23:00 -0500 | 
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2017-06-11 12:23:00 -0500 | 
| commit | fa8a33c57ef8fb0d32e36289bbdbd8ce7cf18726 (patch) | |
| tree | 07838e5971d60452611b58ca30732340e1cc2944 | |
| parent | 24b1cc829fef3a2501ace6ac7e803e3642de45ad (diff) | |
| download | toybox-fa8a33c57ef8fb0d32e36289bbdbd8ce7cf18726.tar.gz | |
Provide error messages for files we can open but not read (ala directories).
| -rw-r--r-- | toys/posix/grep.c | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/toys/posix/grep.c b/toys/posix/grep.c index c7b44e58..891f7600 100644 --- a/toys/posix/grep.c +++ b/toys/posix/grep.c @@ -102,7 +102,10 @@ static void do_grep(int fd, char *name)      int mmatch = 0;      lcount++; -    if (0 > (len = getdelim(&line, &unused, TT.indelim, file))) break; +    errno = 0; +    len = getdelim(&line, &unused, TT.indelim, file); +    if (errno) perror_msg("%s", name); +    if (len<1) break;      if (line[len-1] == TT.indelim) line[len-1] = 0;      start = line; | 
