[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Call clearerr() on stdout before close_stream() is called.
From: |
David Cantrell |
Subject: |
[PATCH] Call clearerr() on stdout before close_stream() is called. |
Date: |
Thu, 4 Feb 2016 05:46:41 -0500 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
This is seen in bison and possibly other programs. Bison will
incorrectly receive SIGPIPE and terminate because close_stream() is
picking up a rogue EPIPE in errno. Before fclose(), clearerr(stdout)
needs to be called so that the errors it will check for are for the
immediate call of close_stream().
---
lib/closeout.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/closeout.c b/lib/closeout.c
index 311faf4..36895a2 100644
--- a/lib/closeout.c
+++ b/lib/closeout.c
@@ -106,6 +106,8 @@ close_stdout_set_ignore_EPIPE (bool ignore)
void
close_stdout (void)
{
+ clearerr (stdout);
+
if (close_stream (stdout) != 0
&& !(ignore_EPIPE && errno == EPIPE))
{
--
1.9.0
- [PATCH] Call clearerr() on stdout before close_stream() is called.,
David Cantrell <=