[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22278: [PATCH] grep: report line-buffered write error right away
From: |
Paul Eggert |
Subject: |
bug#22278: [PATCH] grep: report line-buffered write error right away |
Date: |
Wed, 30 Dec 2015 23:38:24 -0800 |
* src/grep.c (prline): When line buffered, if there is a write
error, report it immediately rather than waiting until the next
line of output.
---
src/grep.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/grep.c b/src/grep.c
index 06f315d..696f4ce 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1180,6 +1180,9 @@ prline (char *beg, char *lim, char sep)
if (!only_matching && lim > beg)
fwrite (beg, 1, lim - beg, stdout);
+ if (line_buffered)
+ fflush (stdout);
+
if (ferror (stdout))
{
write_error_seen = true;
@@ -1187,9 +1190,6 @@ prline (char *beg, char *lim, char sep)
}
lastout = lim;
-
- if (line_buffered)
- fflush (stdout);
}
/* Print pending lines of trailing context prior to LIM. Trailing context ends
--
2.5.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#22278: [PATCH] grep: report line-buffered write error right away,
Paul Eggert <=