]> Savannah Git Hosting - gnulib.git/commit
freopen: work around glibc bug with closed fd
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Nov 2016 22:53:29 +0000 (14:53 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Nov 2016 22:54:38 +0000 (14:54 -0800)
commitb947d0524d64b5a139282fd48caa7a866e20513c
tree4719c46b1cefe2f15e1f1fd23fac8d09c091f112
parent0a2d091427da29e9d956b108801cdfdc27713a09
freopen: work around glibc bug with closed fd

Work around glibc bug#15589, where freopen mishandles the case
where stdin etc. are already closed.
* doc/posix-functions/freopen.texi (freopen): Document the bug.
* lib/freopen.c (_GL_ALREADY_INCLUDING_STDIO_H): Define this
instead of __need_FILE, as the latter does not work with glibc.
Include <fcntl.h>, for open flags.
(rpl_freopen): Work around glibc bug.
* m4/freopen.m4 (gl_FUNC_FREOPEN): Check for bug.
* modules/freopen (Depends-on): Add fcntl-h.
* tests/test-freopen.c (main): Test for bug.
ChangeLog
doc/posix-functions/freopen.texi
lib/freopen.c
m4/freopen.m4
modules/freopen
tests/test-freopen.c