Hi, 

This morning, while reading through recent commits, I noticed that 69c57466a 
added a check for fclose(), with the explanation that “write errors (like 
ENOSPC) may not be reported until close time.” More generally, an fclose() 
failure can also reflect an earlier buffered write or flush failure that is 
only reported when the stream is closed. So it seems worth checking these calls 
in other file-writing paths as well.

So I did a quick search through the source tree, and I found several other 
fclose() calls whose results are not checked. This patch fixes some of them.

My criteria for including cases in this patch were basically:

* only output file descriptors
* code paths where the logic is relatively clear and easy to handle

If this patch gets processed, I would be happy to spend more time handling the 
remaining cases. Or, if committers think all remaining cases should be included 
in this patch, I would also be happy to expand it.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Reply via email to