dup2: work around Haiku bug
authorEric Blake <eblake@redhat.com>
Tue, 1 Feb 2011 03:14:37 +0000 (20:14 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 1 Feb 2011 03:58:59 +0000 (20:58 -0700)
commit0e9ef9b9c9cd7036960656c797f0567b742e7b80
tree704d2715c22455f0495a3115a34cadc3dc570237
parentddf6704b29173e809f3b0150c015ca282e06388f
dup2: work around Haiku bug

dup2(n,n) must be a no-op, but on Haiku, it resets FD_CLOEXEC.
However, we must keep the Linux workaround for dup2(n,n)
returning (unsigned int)-EBADF.

* m4/dup2.m4 (gl_FUNC_DUP2): Test for bug.
* lib/dup2.c (rpl_dup2) [!WIN32]: Add workaround.
* doc/posix-functions/dup2.texi (dup2): Document the bug.
* tests/test-dup2.c (main): Enhance test.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-functions/dup2.texi
lib/dup2.c
m4/dup2.m4
tests/test-dup2.c