summaryrefslogtreecommitdiff
path: root/lib/openat-proc.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* at-internal: Make more robust in multithreaded applications.Bruno Haible2020-05-281-2/+3
| | | | | * lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to open().
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* openat_proc_name: fix that last '/' is overwritten on OS/2 kLIBCKO Myung-Hun2016-01-241-1/+1
| | | | | * lib/openat-proc.c (openat_proc_name): Increase dirlen by 1 after copying a directory.
* openat_proc_name: port to OS/2 kLIBCPaul Eggert2016-01-151-56/+88
| | | | | | | | OS/2 kLIBC provides a function to retrive a path from a fd. Use it instead of /proc/self/fd. * lib/openat-proc.c (openat_proc_name): Don't assume file name length is less than INT_MAX. Port to OS/2 kLIBC with __libc_Back_ioFHToPath().
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* fchdir: port 'open' and 'close' redefinitions to AIX 7.1Paul Eggert2014-05-221-8/+0
| | | | | | | | | | | | | | | * lib/chown.c, lib/clean-temp.c, lib/copy-file.c, lib/execute.c: * lib/fsusage.c, lib/gc-gnulib.c, lib/javacomp.c, lib/mountlist.c: * lib/openat-proc.c, lib/pagealign_alloc.c, lib/progreloc.c: * lib/spawn-pipe.c: Do not #undef 'open' and 'close'. AIX 7 does '#define open open64' and then 'int open64(const char *, int, ...);', which means the declaration for 'open' gets lost if we later '#undef open'. Discovered while building grep pretest 2.18.151-1c770 on AIX 7.1, where the compilation reported the non-fatal error "In function 'openat_proc_name' ... warning: implicit declaration of function 'open'". In this case the error is relatively harmless, but in other cases it might not be so minor.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* openat: correct new commentBastien Roucariès2011-05-101-4/+5
| | | | * lib/openat-proc.c (openat_proc_name): Correct the comment.
* openat: add commentsJim Meyering2011-05-101-0/+4
| | | | | * lib/openat-proc.c (openat_proc_name): Add comments, mostly from Eric Blake.
* openat: reduce syscalls in first probe of /procEric Blake2011-05-091-11/+5
| | | | | | | | | | | | | open/access/close is cheaper than open/stat/stat/close. Use O_DIRECTORY for safety. * lib/openat-proc.c (openat_proc_name): Require that /proc/self/fd be a directory. Simplify the probe for .. bugs. * modules/openat (Depends-on): Drop same-inode. Reported by Bastien ROUCARIES. Signed-off-by: Eric Blake <eblake@redhat.com>
* * lib/openat-proc.c: Don't include dirname.h; not needed.Paul Eggert2011-02-241-1/+0
|
* openat, save-cwd: avoid xmallocPaul Eggert2011-01-111-3/+10
| | | | | | | | | | | | | | | This removes a direct (but undocumented) dependency of openat on xalloc, along with an indirect dependency via save-cwd. It also removes a dependency of save-cwd on xgetcwd, and thereby indirectly on xalloc. This change causes the openat substitute to fall back on save_cwd when memory is tight, and for save_cwd to fail instead of dying when memory is tight, but that's good enough. * lib/openat-proc.c: Include stdlib.h (for malloc), not xalloc.h (for xmalloc). (openat_proc_name): Use malloc, not xmalloc. * lib/save-cwd.c (save_cwd): Use getcwd, not xgetcwd. * modules/save-cwd (Files): Depend on getcwd, not xgetcwd.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* fcntl-h, etc.: prefer O_SEARCH to O_RDONLY when applicablePaul Eggert2010-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | POSIX 2008 specifies a new 'open' flag O_SEARCH, which can be used when one needs search access to a directory but not read access. On systems where it is available, it works in some cases where O_RDONLY does not, namely on directories that are searchable but not readable, and which need only to be searchable. If O_SEARCH is not available, fall back to the traditional method of using O_RDONLY. * lib/fcntl.in.h (O_SEARCH): #define to O_RDONLY if not defined. * lib/chdir-long.c (cdb_advance_fd): Use O_SEARCH, not O_RDONLY, when opening a directory that needs only to be searchable. * lib/chdir-safer.c (chdir_no_follow): Likewise. * lib/fts.c (diropen, fts_open, fd_ring_check): Likewise. * lib/openat-proc.c (openat_proc_name): Likewise. * lib/openat.c (openat_needs_fchdir): Likewise. * lib/save-cwd.c (save_cwd): Likewise. * lib/savewd.c (savewd_save, savewd_chdir): Likewise.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* openat: Fix warning.Bruno Haible2009-12-251-0/+1
|
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-19/+19
|
* openat: fail with ENOENT on empty nameEric Blake2009-09-041-0/+7
| | | | | | | * lib/openat-proc.c (openat_proc_name): Special-case the empty buffer. Signed-off-by: Eric Blake <ebb9@byu.net>
* backupfile, chdir-long, fts, savedir: make saferEric Blake2009-09-021-2/+5
| | | | | | | | | | | | | | | | | | | * lib/backupfile.c (includes): Use "dirent--.h", since numbered_backup can write to stderr during readdir. * lib/savedir.c (includes): Likewise. * lib/chdir-long.c (includes): Use "fcntl--.h", since openat emulation can write to stderr on failure. * lib/fts.c (includes) [!_LIBC]: Likewise for opendir and openat. * lib/getcwd.c: Document why opendir_safer is unused. * lib/glob.c: Likewise. * lib/scandir.c: Likewise. * lib/openat-proc.c: Likewise, for open_safer. * modules/backupfile (Depends-on): Add dirent-safer. * modules/savedir (Depends-on): Likewise. * modules/fts (Depends-on): Add dirent-safer and openat-safer. * modules/chdir-long (Depends-on): Add openat-safer. Signed-off-by: Eric Blake <ebb9@byu.net>
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* New module 'fchdir'.Bruno Haible2007-01-141-0/+5
|
* [lib/ChangeLog]Paul Eggert2006-09-301-0/+90
Work around bug in Solaris 10 /proc file system: /proc/self/fd/NNN/.. isn't the parent directory of the directory whose file descriptor is NNN. This needs to be worked around at run time, not compile time, since a program might be built on Solaris 8, where things work, and run on Solaris 10. * openat-priv.h (BUILD_PROC_NAME): Remove. All callers changed to use the following interface instead: (OPENAT_BUFFER_SIZE): New macro. (openat_proc_name): New function. * at-func.c (AT_FUNC_NAME): Adjust to above changes. * openat.c (openat_permissive, openat_needs_fchdir, fdopendir): Likewise. * openat-proc.c: New file. [ChangeLog] * modules/openat (Files): Add lib/openat-proc.c. (Depends-on): Add same-inode, stdbool. [m4/ChangeLog] * openat.m4 (gl_FUNC_OPENAT): Add AC_LIBOBJ(openat-proc).