Eric Blake <e...@byu.net> writes: > According to Simon Josefsson on 1/8/2010 2:36 AM: >> I got this on MinGW: >> >> test-dup2.c:140: assertion failed >> FAIL: test-dup2.exe > > I wish mingw had a better version number reporting scheme. I can't > reproduce the failure when I cross-compile from cygwin to mingw, then run > the program natively on Windows (that is, using the mingw libraries that > ship with cygwin 1.7.1), but I'll take your word for it. Maybe this is a > bug in wine?
Yes it was: http://bugs.winehq.org/show_bug.cgi?id=21289 The problem is that Wine's dup2 will return 0 for negative desired_fd, and gnulib's rpl_dup2 will then make the return value for rpl_dup2 be desired_fd. Which is wrong. I pushed the improved comment below. /Simon >From 581419c98c50af5daefcbb07ca1cbc16539db072 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Fri, 8 Jan 2010 23:29:17 +0100 Subject: [PATCH] lib/dup2.c (rpl_dup2): Improve comment. --- ChangeLog | 4 ++++ lib/dup2.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1d9a6a..4d4137e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-01-08 Simon Josefsson <si...@josefsson.org> + + * lib/dup2.c (rpl_dup2): Improve comment. + 2010-01-08 Eric Blake <e...@byu.net> maint.mk: allow packages to add makefile @@ exceptions diff --git a/lib/dup2.c b/lib/dup2.c index 9b6a8f6..a4422bf 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -52,8 +52,8 @@ rpl_dup2 (int fd, int desired_fd) } return fd; } - /* Some mingw versions also return the wrong value if desired_fd is - negative but not -1. */ + /* 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; -- 1.6.6