dup2
====

POSIX specification:
 http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html

Gnulib module: dup2 or dup2-obsolete

Portability problems fixed by either Gnulib module dup2 or dup2-obsolete:

  * This function always returns 0 for success on some platforms: mingw, MSVC 9.

  * This function can hang when duplicating an fd to itself on some platforms: mingw, MSVC 9.

  * This function crashes when invoked with invalid arguments on some platforms: Cygwin 1.7.17, MSVC 9.

  * This function resets the FD_CLOEXEC flag when duplicating an fd to itself on some platforms: Haiku.

  * This function returns 0 for dup2 (1, 1) on some platforms: Cygwin 1.5.x.

  * This function may return -EBADF instead of -1 on some platforms: Linux releases between July 2008 and May 2009 (versions 2.6.27 to 2.6.29).

  * This function returns EMFILE instead of EBADF for extremely large targets, which interferes with using dup2(fd,fd)==fd) as the minimal EBADF filter: FreeBSD 6.1, Cygwin 1.5.

Portability problems fixed by Gnulib module dup2-obsolete:

  * This function is missing on some older platforms.

Portability problems not fixed by Gnulib: