Re: dup2 on mingw

2009-07-21 Thread Eric Blake
Eric Blake byu.net> writes: > Well, it would be nice if doing that didn't hang mingw. It looks like > Microsoft has a bug, because using dup2(fd,fd) when fd is closed appears to > deadlock the process. mingw also hangs on the second dup2 in dup2(fd,fd),dup2(fd,fd+1) if fd is open (meaning th

Re: dup2 on mingw

2009-07-21 Thread Eric Blake
Eric Blake byu.net> writes: > > Yes, that's definitely a portability pitfall that warrants a wrapper module. > > And in writing the testcase, I learned that cygwin 1.5 also has a bug, in > that dup2(1,1) returns 0 (but at least cygwin's dup2(1,2) returns 2). > Although you seldom see code using

Re: dup2 on mingw

2009-07-21 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 7/20/2009 6:00 PM: > Eric Blake wrote: >> On mingw, dup2 always returns 0 for success, rather than the fd just opened. >> So I guess I'll start the process of writing a dup2 replacement module; > > Yes, that's definitely a

Re: dup2 on mingw

2009-07-20 Thread Bruno Haible
Eric Blake wrote: > On mingw, dup2 always returns 0 for success, rather than the fd just opened. > So I guess I'll start the process of writing a dup2 replacement module; Yes, that's definitely a portability pitfall that warrants a wrapper module. Bruno