Re: fix mkostemp, add pipe2-safer

2009-12-09 Thread Bruno Haible
Eric Blake wrote: > On cygwin, native fcntl(F_DUPFD), dup, and dup2; and our > version of dup_cloexec, already copy the text/binary mode of the source. > So why not make mingw do the same, rather than blindly slamming to O_BINARY. > ... > Here's what I've tested on mingw and cygwin; now pushed. Lo

Re: fix mkostemp, add pipe2-safer

2009-12-09 Thread Bruno Haible
Hi Eric, > > - In set_cloexec_flag: You added a call to > > dup2 (desc, desc) > > But on a POSIX compliant system this is a no-op, since > > Not quite. It is the fastest one-syscall sequence for determining whether > an fd is open Oh, I see. That wasn't clear to me. > Okay, then, a comme

Re: fix mkostemp, add pipe2-safer

2009-12-07 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 12/6/2009 5:18 PM: > - The code accesses an undefined variable 'result'. You caught one, but missed the other. I noticed some other things while fixing it. Pushing these: - -- Don't work too hard, make some time for f

Re: fix mkostemp, add pipe2-safer

2009-12-07 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 12/6/2009 5:53 PM: >> If this is specifically targeted at non-POSIX systems, it would be good to >> have >> a comment about it. > > Okay, then, a comment describing that dup2 is used as an EBADF filter, and > not for an

Re: fix mkostemp, add pipe2-safer

2009-12-06 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 12/6/2009 5:18 PM: > - In set_cloexec_flag: You added a call to > dup2 (desc, desc) > But on a POSIX compliant system this is a no-op, since Not quite. It is the fastest one-syscall sequence for determining whether

Re: fix mkostemp, add pipe2-safer

2009-12-06 Thread Bruno Haible
Hi Eric, Great! I like the direction of your patches, unifying the support of *_safer and the native Woe32 requirements in a single API. I also like that the cloexec module now becomes usable for code that is portable to mingw; set_cloexec_flag is not in this category. Detailed review: - In dup_

Re: fix mkostemp, add pipe2-safer

2009-12-06 Thread Jim Meyering
Eric Blake wrote: > I'm currently testing the following series. Any thoughts or review on this? Good catch on mkostemp, and the many new tests are always welcome. As far as I can see (I didn't study the W32-specific bits), this all looks fine. I confirmed that it builds and all tests pass when

fix mkostemp, add pipe2-safer

2009-12-05 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm currently testing the following series. Any thoughts or review on this? Eric Blake (5): cloexec: add dup_cloexec Rather than having dup_noinherit, specific to w32spawn.h, it seems better to have a version also ported to Unix. Eventually, w