[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does close_stdout close stdout and stderr?
From: |
Florian Weimer |
Subject: |
Re: Why does close_stdout close stdout and stderr? |
Date: |
Mon, 06 May 2019 17:47:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
* Bernhard Voelker:
> On 5/6/19 2:05 PM, Florian Weimer wrote:
>>>> 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.
>
>> This means that for Linux at least, close_stdout should just call
>> fflush, not fclose.
>
> What is the problem? I mean if it is use-after-free as mentioned in
> the first mail, then write() after fflush() without error checking via
> another fflush() is in the same category, isn't it?
No, there is no memory corruption involved because stdout and stderr
remain valid.
Thanks,
Florian
- Re: Why does close_stdout close stdout and stderr?, Florian Weimer, 2019/05/06
- Re: Why does close_stdout close stdout and stderr?, Bernhard Voelker, 2019/05/06
- Re: Why does close_stdout close stdout and stderr?,
Florian Weimer <=
- Re: Why does close_stdout close stdout and stderr?, Bernhard Voelker, 2019/05/06
- Re: Why does close_stdout close stdout and stderr?, Florian Weimer, 2019/05/06
- Re: Why does close_stdout close stdout and stderr?, Bernhard Voelker, 2019/05/09
- Re: Why does close_stdout close stdout and stderr?, Florian Weimer, 2019/05/09
- Re: Why does close_stdout close stdout and stderr?, Bernhard Voelker, 2019/05/09
- Re: Why does close_stdout close stdout and stderr?, Paul Eggert, 2019/05/09
- Re: Why does close_stdout close stdout and stderr?, Kamil Dudka, 2019/05/10
- Re: Why does close_stdout close stdout and stderr?, Florian Weimer, 2019/05/10
- Re: Why does close_stdout close stdout and stderr?, Paul Eggert, 2019/05/12
- Re: Why does close_stdout close stdout and stderr?, Florian Weimer, 2019/05/13