cloexec: add dup_cloexec
authorEric Blake <ebb9@byu.net>
Sat, 5 Dec 2009 05:10:44 +0000 (22:10 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 5 Dec 2009 21:29:23 +0000 (14:29 -0700)
commitd8ccc13ba3ba05654f9be09bba5492cc8da30c3b
treea7f6fdae30b716c3a409a7affd1d809d1c8eae0a
parenta4cfedb07defccd91a1b8290ab57be337bfd04b4
cloexec: add dup_cloexec

This is needed to enforce correct semantics of mkostemp_safer.
Meanwhile, it is one step closer to providing O_CLOEXEC support
to open, as well as implementing portions of fcntl for mingw.

* lib/cloexec.h (dup_cloexec): New prototype.  Add copyright
header and comments.
* lib/cloexec.c (set_cloexec_flag): Add comments.
(dup_cloexec): New function, with mingw implementation borrowed
from...
* lib/w32spawn.h (dup_noinherit): ...here.
* modules/execute (Depends-on): Add cloexec.
* modules/pipe (Depends-on): Likewise.
* modules/cloexec (Depends-on): Add dup2.
* modules/cloexec-tests (Files): New file.
* tests/test-cloexec.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/cloexec.c
lib/cloexec.h
lib/w32spawn.h
modules/cloexec
modules/cloexec-tests [new file with mode: 0644]
modules/execute
modules/pipe
tests/test-cloexec.c [new file with mode: 0644]