Proposed fix: exit on the first EPIPE error in case the SIGPIPE is blocked.

http://bugzilla.redhat.com/show_bug.cgi?id=741452
---
 src/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/main.c b/src/main.c
index 51135ad..4ca326b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,6 +30,7 @@
 #include <wctype.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 #include "system.h"
 
 #include "argmatch.h"
@@ -881,7 +882,7 @@ prline (char const *beg, char const *lim, int sep)
     fwrite (beg, 1, lim - beg, stdout);
 
   if (ferror (stdout))
-    error (0, errno, _("writing output"));
+    error ((errno == EPIPE) ? EXIT_FAILURE : 0, errno, _("writing output"));
 
   lastout = lim;
 
-- 
1.7.7.5


Reply via email to