Commit Graph

6 Commits

Author SHA1 Message Date
Sami Kerola b211467f77 closestream: remove dummy function __fpending()
Exclude __fpending() from build when function is not available.  This is
more obvious than adding a dummy function and expecting compiler to
eliminate it as dead code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-03-27 13:51:02 +02:00
Karel Zak 090d8c763a include/closestream: define exit codes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-16 13:35:06 +02:00
Karel Zak 422f93bfbb 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>
2014-03-13 12:41:03 +01:00
Sami Kerola f416563b28 include: add close_fd() for noticing write errors before close()
Essentially this helper function is similar to close_stream(), but for
file descriptors.

When a file descriptors are close()'d status of write is often
overlooked.  The close_fd() will try to determine what happen to writes
with fsync() before closing the file descriptor.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:06 +02:00
Sami Kerola 78288764e4 build-sys: determine availability of __fpending()
Needed to for making Cygwin more possible.

Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/5656
Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-23 14:26:23 +02:00
Sami Kerola 302e423dc1 include: add stream error checking facility
The close_stream() is copied from GNU lib.  Inspiration to do this is
talk by Jim Meyering - Goodbye World! The perils of relying on output
streams in C.

Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:45:37 +02:00