1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-14 14:01:48 +03:00
Files
gnulib/modules/fd-safer-flag
Eric Blake e4ee142063 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>
2009-12-16 19:25:36 -07:00

28 lines
413 B
Plaintext

Description:
fd_safer_flag() function: adjust a file descriptor result so that it avoids
clobbering STD{IN,OUT,ERR}_FILENO, with specific flags.
Files:
lib/fd-safer-flag.c
lib/dup-safer-flag.c
Depends-on:
cloexec
fcntl
unistd-safer
configure.ac:
gl_MODULE_INDICATOR([fd-safer-flag])
Makefile.am:
lib_SOURCES += fd-safer-flag.c dup-safer-flag.c
Include:
"unistd-safer.h"
License:
GPL
Maintainer:
Eric Blake