bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does close_stdout close stdout and stderr?


From: Eric Blake
Subject: Re: Why does close_stdout close stdout and stderr?
Date: Mon, 29 Apr 2019 14:49:39 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]