dup2, dup3: work around another cygwin crasher
[gnulib.git] / doc / posix-functions / dup2.texi
1 @node dup2
2 @section @code{dup2}
3 @findex dup2
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html}
6
7 Gnulib module: dup2 or dup2-obsolete
8
9 Portability problems fixed by either Gnulib module @code{dup2} or @code{dup2-obsolete}:
10 @itemize
11 @item
12 This function always returns 0 for success on some platforms:
13 mingw, MSVC 9.
14
15 @item
16 This function can hang when duplicating an fd to itself on some platforms:
17 mingw, MSVC 9.
18
19 @item
20 This function crashes when invoked with invalid arguments on some platforms:
21 Cygwin 1.7.17, MSVC 9.
22
23 @item
24 This function crashes when invoked with valid arguments on some platforms:
25 Cygwin 1.7.25.
26
27 @item
28 This function resets the @code{FD_CLOEXEC} flag when duplicating an fd
29 to itself on some platforms:
30 Haiku.
31
32 @item
33 This function returns 0 for @code{dup2 (1, 1)} on some platforms:
34 Cygwin 1.5.x.
35
36 @item
37 This function may return @code{-EBADF} instead of @code{-1} on some platforms:
38 Linux releases between July 2008 and May 2009 (versions 2.6.27 to 2.6.29).
39
40 @item
41 This function returns @code{EMFILE} instead of @code{EBADF} for
42 extremely large targets, which interferes with using
43 @code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter:
44 FreeBSD 6.1, Cygwin 1.5.
45 @end itemize
46
47 Portability problems fixed by Gnulib module @code{dup2-obsolete}:
48 @itemize
49 @item
50 This function is missing on some older platforms.
51 @end itemize
52
53 Portability problems not fixed by Gnulib:
54 @itemize
55 @end itemize