[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] grep: remove unnecessary "what-if-signal?" code
From: |
Paul Eggert |
Subject: |
[PATCH] grep: remove unnecessary "what-if-signal?" code |
Date: |
Fri, 01 Jun 2012 08:07:55 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
I pushed the following as an obvious cleanup of code that
I mistakenly introduced to grep in the previous millennium.
* src/main.c (fillbuf): Don't worry about EINTR when closing --
not possible, since we're not catching signals.
---
src/main.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/src/main.c b/src/main.c
index 10fbfac..dda7c9b 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)
--
1.7.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] grep: remove unnecessary "what-if-signal?" code,
Paul Eggert <=