I should've added:
On 2019-05-07 3:44 a.m., Assaf Gordon wrote:
I'm attaching a sample test program to illustrate some points.
The program writes to stdout/stderr then optionally calls
fclose/fflush/fsync.
Note the following:
The attached program also calls "ferror" on the stream,
but it does not signal an error in those listed cases.
Also note that the output of the program is purposefully small ("Hello\n").
If it was large enough to fill libc's buffer and cause a write(2),
then the errors would be returned to the application.
But if the output is small - such errors are lost.
-assaf