Re: [PATCH] xfreopen: keep append mode when converting stdout to binary

2010-03-10 Thread Eric Blake
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

Re: [PATCH] xfreopen: keep append mode when converting stdout to binary

2010-03-10 Thread Bruno Haible
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.

[PATCH] xfreopen: keep append mode when converting stdout to binary

2010-03-10 Thread Eric Blake
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