[PATCH] prevent retries on fclose/fflush after write errors

Michael Deutschmann michael at talamasca.ocis.net
Fri Mar 23 23:28:24 UTC 2012


On Wed, 14 Mar 2012, Mike Frysinger wrote:
> we already provide the helper TEMP_FAILURE_RETRY() for people who want
> this, so that should be sufficient for those who want to opt in to that
> behavior.

TEMP_FAILURE_RETRY can't wrap stdio functions.  stdio features a sticky
error flag, expressly so that one can attempt a series of reads or writes
and only check for errors once at the end.  So once a read/write is
blocked by EINTR, it will stay blocked until you explicitly do a
clearerr().

Adding clearerr() to an otherwise TEMP_FAILURE_RETRY-like loop will not
work sanely.  See the discussion in glibc's manual (a node I mostly
wrote) for details:

http://www.gnu.org/software/libc/manual/html_node/Error-Recovery.html

---- Michael Deutschmann <michael at talamasca.ocis.net>


More information about the uClibc mailing list