GNU bug report logs - #22278
[PATCH] grep: report line-buffered write error right away

Previous Next

Package: grep;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Thu, 31 Dec 2015 07:39:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22278 in the body.
You can then email your comments to 22278 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#22278; Package grep. (Thu, 31 Dec 2015 07:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Thu, 31 Dec 2015 07:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-grep <at> gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: [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





bug closed, send any further explanations to 22278 <at> debbugs.gnu.org and Paul Eggert <eggert <at> cs.ucla.edu> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 31 Dec 2015 08:56:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Jan 2016 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 148 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.