On 4/29/19 2:45 PM, Florian Weimer wrote: > I get that error checking is important. But why not just use ferror and > fflush? Closing the streams is excessive and tends to introduce > use-after-free issues, as evidenced by the sanitizer workarounds. If I recall the explanation, at least some versions of NFS do not actually flush on fflush(), but wait until close(). If you want to avoid data loss and ensure that things written made it to the remote storage while detecting every possible indication when an error may have prevented that from working, then you have to go all the way through close(). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org