On 03/10/2010 04:43 PM, Bruno Haible wrote:
> I would find it better to leave xfreopen alone and add a function
>
> /* Returns the current mode of FP, combined with the additional
> open_flags. Allowed open_flags are O_APPEND, O_TEXT, O_BINARY,
> or a combination of these. */
> con
Hi Eric,
> For a long time, we've had reports against coreutils about improper
> use of freopen(NULL) on platforms with non-zero O_BINARY: basically,
> when built out of the box, things like 'cat a >> b' would overwrite
> data in b, because the freopen(NULL,"wb",stdout) lost the O_APPEND
> flag.
Particularly useful for porting coreutils to cygwin.
* lib/xfreopen.c (xfreopen): Preserve O_APPEND when using xfreopen
to convert an existing stream to binary.
Signed-off-by: Eric Blake
---
For a long time, we've had reports against coreutils about improper
use of freopen(NULL) on platforms wi