Hash :
996f76cd
Author :
Date :
2009-09-19T07:12:15
openat: allow return of fd 0 Partially reverts patch fc33350 from 2009-09-02. * modules/chdir-long (Depends-on): Relax openat-safer to openat. * modules/save-cwd (Depends-on): Replace fcntl-safer with unistd-safer. * lib/chdir-long.c (includes): Replace "fcntl--.h" with <fcntl.h>; this module does not leak fds. * lib/openat.c (includes): Do not use "fcntl_safer"; plain openat must be allowed to return 0, leaving openat_safer to add the safety. (openat_permissive): Avoid writing to just-opened fd 2 if restoring the current directory fails. * lib/openat-die.c (openat_restore_fail): Add comment. * lib/save-cwd.c (includes): Make "fcntl--.h" conditional. (save_cwd): Guarantee safe fd, but without use of open_safer. * tests/test-openat.c: New test. * modules/openat-tests (Files, Makefile.am): Distribute and build new file. Signed-off-by: Eric Blake <ebb9@byu.net>
Description:
chdir-like function that tries not to fail due to ENAMETOOLONG
Files:
lib/chdir-long.h
lib/chdir-long.c
m4/chdir-long.m4
Depends-on:
atexit
fchdir
fcntl-h
openat
memchr
mempcpy
memrchr
stdbool
configure.ac:
gl_FUNC_CHDIR_LONG
Makefile.am:
Include:
"chdir-long.h"
License:
GPL
Maintainer:
Jim Meyering