fcntl: use to simplify other modules
authorEric Blake <ebb9@byu.net>
Wed, 16 Dec 2009 17:07:13 +0000 (10:07 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 17 Dec 2009 02:25:36 +0000 (19:25 -0700)
commite4ee142063a2f63f483d32b4ab87387db9130804
tree1b10241bfaebf75e29857b8e73ffc910f29808e5
parent021c8619190757f535c72ad5cdb1d624e19620d6
fcntl: use to simplify other modules

Let fcntl do the work, instead of copying code into other modules.

* modules/cloexec (Depends-on): Add fcntl.
* modules/fchdir (Depends-on): Likewise.
* modules/fd-safer-flag (Depends-on): Likewise.
* modules/unistd-safer (Depends-on): Likewise.
* modules/dup3 (configure.ac): Set module indicator.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Replace fcntl if fchdir is
missing.
* lib/fchdir.c (_gl_register_dup): Fix comment.
* lib/cloexec.c (dup_cloexec): Simplify, by relying on fcntl.
* lib/dup-safer.c (dup_safer): Likewise.
* lib/dup-safer-flag.c (dup_safer_flag): Likewise.
* lib/dup3.c (dup3): Likewise.
* tests/test-fchdir.c (main): Enhance test.
Fixes a dup_cloexec bug reported by Ondřej Vašík.

Signed-off-by: Eric Blake <ebb9@byu.net>
13 files changed:
ChangeLog
lib/cloexec.c
lib/dup-safer-flag.c
lib/dup-safer.c
lib/dup3.c
lib/fchdir.c
m4/fchdir.m4
modules/cloexec
modules/dup3
modules/fchdir
modules/fd-safer-flag
modules/unistd-safer
tests/test-fchdir.c