Clear flags2 flags set from mode in freopen (bug 32134)

Florian Weimer fweimer@redhat.com
Thu Sep 5 04:16:12 GMT 2024


* Joseph Myers:

> As reported in bug 32134, freopen does not clear the flags set in
> fp->_flags2 by the "e", "m" or "c" mode characters.  Clear these so
> that they can be set or not as appropriate from the mode string passed
> to freopen.  The relevant test for "e" in tst-freopen2-main.c is
> enabled accordingly; "c" is expected to be covered in a separately
> written test (and while tst-freopen2-main.c does include transitions
> to and from "m", that's not really a semantic flag intended to result
> in behaving in an observably different way).
>
> Tested for x86_64.

Looks okay.  The _flags2 field is available in the old version of the
FILE struct.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list