Paul Eggert wrote:
Isn't that a bug in glibc freopen?
It turns out to be a known bug; glibc bug#15589 and glibc bug#15701. I have added notes there about this:
https://sourceware.org/bugzilla/show_bug.cgi?id=15589 https://sourceware.org/bugzilla/show_bug.cgi?id=15701
