about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-17 03:08:53 -0500
committerRich Felker <dalias@aerifal.cx>2015-03-30 01:41:33 -0400
commit0d418ce688da6bc80073539f372be84faf7139d1 (patch)
tree668a137d340d17b7ac790b26778e12720bbcab0a /include
parent051a8fdda8a08bcbea8d5a148fe26fa73adc58b8 (diff)
downloadmusl-0d418ce688da6bc80073539f372be84faf7139d1.tar.gz
musl-0d418ce688da6bc80073539f372be84faf7139d1.tar.xz
musl-0d418ce688da6bc80073539f372be84faf7139d1.zip
correctly handle write errors encountered by printf-family functions
previously, write errors neither stopped further output attempts nor
caused the function to return an error to the caller. this could
result in silent loss of output, possibly in the middle of output in
the event of a non-permanent error.

the simplest solution is temporarily clearing the error flag for the
target stream, then suppressing further output when the error flag is
set and checking/restoring it at the end of the operation to determine
the correct return value.

since the wide version of the code internally calls the narrow fprintf
to perform some of its underlying operations, initial clearing of the
error flag is suppressed when performing a narrow vfprintf on a
wide-oriented stream. this is not a problem since the behavior of
narrow operations on wide-oriented streams is undefined.

(cherry picked from commit d42269d7c85308abdbf8cee38b1a1097249eb38b)
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions