diff options
author | Karel Zak | 2014-03-13 12:41:03 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-13 12:41:03 +0100 |
commit | 422f93bfbb5df358fad3fedfe9eb0247cbf3cb14 (patch) | |
tree | ee17945ed10cb0c4c8ee1b9951bbd78823ae75a3 | |
parent | dmesg: don't report EPIPE (diff) | |
download | kernel-qcow2-util-linux-422f93bfbb5df358fad3fedfe9eb0247cbf3cb14.tar.gz kernel-qcow2-util-linux-422f93bfbb5df358fad3fedfe9eb0247cbf3cb14.tar.xz kernel-qcow2-util-linux-422f93bfbb5df358fad3fedfe9eb0247cbf3cb14.zip |
include/closestream: don't wipe errno on EPIPE
... the code in close_stdout() is sensitive to EPIPE, so
wipe errno is close_stream() is probably bad idea.
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | include/closestream.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/closestream.h b/include/closestream.h index 2535c8b22..7842456fb 100644 --- a/include/closestream.h +++ b/include/closestream.h @@ -24,8 +24,9 @@ close_stream(FILE * stream) const int some_pending = (__fpending(stream) != 0); const int prev_fail = (ferror(stream) != 0); const int fclose_fail = (fclose(stream) != 0); + if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) { - if (!fclose_fail) + if (!fclose_fail && !(errno == EPIPE)) errno = 0; return EOF; } |