X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fdup2.c;h=a4422bf3b8c3aed35e4f5bdf2cf734e0a1ce6056;hb=e8269e90e35140ebb75f39669d39bd021e364105;hp=ad74f5bb982db1427743002bbae75c53ea6d7945;hpb=3030c5b5e0a5199e16b05927da72c43c42f211c3;p=gnulib.git diff --git a/lib/dup2.c b/lib/dup2.c index ad74f5bb9..a4422bf3b 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,6 +52,13 @@ rpl_dup2 (int fd, int desired_fd) } return fd; } + /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: + http://bugs.winehq.org/show_bug.cgi?id=21289 */ + if (desired_fd < 0) + { + errno = EBADF; + return -1; + } # endif result = dup2 (fd, desired_fd); # ifdef __linux__