summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-06-01 08:04:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-06-01 08:05:13 -0700
commit2665746b756bd372ba856e165388dc98032362fd (patch)
treea5a036e38517d388704fde3b3df22e2607af5fa1
parent34e0adabf0cd98eb4d1c4a929acf0b8238fcfbbc (diff)
downloadgrep-2665746b756bd372ba856e165388dc98032362fd.tar.gz
grep: remove unnecessary "what-if-signal?" code
* src/main.c (fillbuf): Don't worry about EINTR when closing -- not possible, since we're not catching signals.
-rw-r--r--src/main.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c
index 10fbfacf..dda7c9b8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -601,7 +601,7 @@ reset (int fd, struct stat const *st)
static int
fillbuf (size_t save, struct stat const *st)
{
- size_t fillsize = 0;
+ ssize_t fillsize;
int cc = 1;
char *readbuf;
size_t readsize;
@@ -662,18 +662,9 @@ fillbuf (size_t save, struct stat const *st)
readsize = buffer + bufalloc - readbuf;
readsize -= readsize % pagesize;
- if (! fillsize)
- {
- ssize_t bytesread;
- while ((bytesread = read (bufdesc, readbuf, readsize)) < 0
- && errno == EINTR)
- continue;
- if (bytesread < 0)
- cc = 0;
- else
- fillsize = bytesread;
- }
-
+ fillsize = read (bufdesc, readbuf, readsize);
+ if (fillsize < 0)
+ fillsize = cc = 0;
bufoffset += fillsize;
#if defined HAVE_DOS_FILE_CONTENTS
if (fillsize)