summaryrefslogtreecommitdiff
path: root/lib/at-func.c
Commit message (Collapse)AuthorAgeFilesLines
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051-1/+1
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* Use module 'filename' instead of module 'dosname'.Bruno Haible2020-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/at-func.c: Include filename.h instead of dosname.h. * lib/unlinkat.c: Likewise. * modules/areadlinkat (Depends-on): Add filename. Remove dosname. * modules/areadlinkat-with-size (Depends-on): Likewise. * modules/faccessat (Depends-on): Likewise. * modules/fchmodat (Depends-on): Likewise. * modules/fchownat (Depends-on): Likewise. * modules/fstatat (Depends-on): Likewise. * modules/mkdirat (Depends-on): Likewise. * modules/mkfifoat (Depends-on): Likewise. * modules/readlinkat (Depends-on): Likewise. * modules/selinux-at (Depends-on): Likewise. * modules/symlinkat (Depends-on): Likewise. * modules/unlinkat (Depends-on): Likewise. * modules/utimensat (Depends-on): Likewise. * lib/at-func2.c: Include filename.h instead of dosname.h. * modules/linkat (Depends-on): Add filename. Remove dosname. * modules/renameatu (Depends-on): Likewise. * lib/canonicalize.c: Include filename.h instead of dosname.h. * lib/canonicalize-lgpl.c: Likewise. * modules/canonicalize (Depends-on): Add filename. * modules/canonicalize-lgpl (Depends-on): Likewise. * lib/dirname.h: Include filename.h instead of dosname.h. * modules/dirname-lgpl (Depends-on): Add filename. Remove dosname. * lib/fchdir.c: Include filename.h instead of dosname.h. * modules/fchdir (Depends-on): Add filename. Remove dosname. * lib/openat.c: Include filename.h instead of dosname.h. * modules/openat (Depends-on): Add filename. Remove dosname. * lib/rmdir.c: Include filename.h instead of dosname.h. * modules/rmdir (Depends-on): Add filename. Remove dosname. * lib/savewd.c: Include filename.h instead of dosname.h. * modules/savewd (Depends-on): Add filename. Remove dosname. * lib/unlink.c: Include filename.h instead of dosname.h. * modules/unlink (Depends-on): Add filename. Remove dosname. * modules/relocatable-prog-wrapper (Depends-on): Add filename. * lib/relocwrapper.c: Update comments. * modules/lstat (Depends-on): Remove dosname.
* 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'.
* 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'.
* 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>
* faccessat, etc.: support AT_FDCWD-only usePaul Eggert2012-10-141-8/+23
| | | | | | | | | | | | | | * lib/at-func.c: If GNULIB_SUPPORT_ONLY_AT_FDCWD, then support this function only if its first argument is AT_FDCWD. Emacs wants faccessat for AT_EACCESS but not for any first-arg values other than AT_FDCWD, so it doesn't want all the openat machinery with fchdir etc. * modules/faccessat, modules/fchmodat, modules/fchownat (Files): * modules/fstatat, modules/mkdirat, modules/openat (Files): * modules/unlinkat (Files): Remove lib/openat-priv.h, as at-internal supplies this file. Removing this file here allows us to support programs like Emacs that avoid at-internal.
* maint: spelling fixesPaul Eggert2012-02-051-1/+1
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* at-func*.c: fix commentsJim Meyering2011-11-041-1/+1
| | | | | * lib/at-func2.c: Correct/improve first-line comment. * lib/at-func.c: Correct grammar in first-line comment.
* dirname: move m4/dos.m4 functionality into lib/dosname.hPaul Eggert2011-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m4/dos.m4 needs to go. It laboriously invokes the C compiler, and extracts symbols from it, puts them into config.h; but it's much easier to use the symbols directly. filename.h already does this, but it disagrees with dos.m4 in some respects. This patch introduces a different include file dosname.h that packages up dos.m4, and then later we can work on merging filename.h and dosname.h. Applications that need only the easy-to-configure symbols should consider including dosname.h rather than dirname.h. * NEWS: Mention incompatible changes. * m4/dos.m4: Remove. * lib/dosname.h, modules/dosname: New files. * lib/dirname.h (ISSLASH, FILE_SYSTEM_PREFIX_LEN): (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Move to lib/dosname.h. * lib/at-func.c, lib/at-func2.c, lib/openat.c, lib/savewd.c: Include dosname.h, not dirname.h. * lib/rmdir.c, lib/stat.c, lib/unlink.c, lib/unlinkat.c: Include dosname.h, for definitions of symbols like ISSLASH that used to be in config.h. * m4/dirname.m4 (gl_DIRNAME_LGPL): Do not require gl_AC_DOS. * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. * m4/stat.m4 (gl_FUNC_STAT): Likewise. * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. * modules/dirname-lgpl (Files): Omit m4/dos.m4. * modules/rmdir (Files): Likewise. * modules/stat (Files): Likewise. * modules/unlink (Files): Likewise. * modules/dirname-lgpl (Depends-on): Add dosname. * modules/lstat (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/rmdir (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * modules/stat (Depends-on): Likewise. * modules/unlink (Depends-on): Likewise. * modules/openat (Depends-on): Remove dirname-lgpl. * modules/savewd (Depends-on): Likewise. * tests/test-dirname.c: Do not use removed symbols like FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR. Instead, use the remaining symbols, e.g., ISSLASH ('\\').
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* 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
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-8/+8
|
* areadlinkat: fix fallback pathEric Blake2009-10-261-1/+1
| | | | | | | * lib/at-func.c (AT_FUNC_NAME): Avoid signed comparison between pointer and zero. Signed-off-by: Eric Blake <ebb9@byu.net>
* areadlinkat: avoid failure on older glibcEric Blake2009-10-211-1/+1
| | | | | | | | | | | | Acting on /proc/self/-1/name gives ENOTDIR. at-func normally falls back to fchdir, which discovers the real problem of invalid fd and changes to EBADF; but for areadlinkat, it mistakenly short-circuited when FUNC_FAIL was NULL (since 0<=(char*)result is always true). * lib/at-func.c (AT_FUNC_NAME): Check for explicit FUNC_FAIL, rather than mis-comparing 0 against FUNC_RESULT of char*. Signed-off-by: Eric Blake <ebb9@byu.net>
* areadlinkat: new moduleEric Blake2009-10-071-4/+12
| | | | | | | | | | | | | | | * lib/at-func.c (FUNC_FAIL): New define. (AT_FUNC_NAME, VALIDATE_FLAG): Use it rather than raw -1. * modules/areadlinkat: New module. * lib/linkat.c (areadlinkat): Move... * lib/areadlinkat.c (areadlinkat): ...to new file. * lib/areadlink.h (areadlinkat): Declare it. * modules/linkat (Depends-on): Add areadlinkat. * MODULES.html.sh (File system functions): Mention it. * modules/areadlinkat-tests: New test. * tests/test-areadlinkat.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* openat, utimens: whitespace cleanupEric Blake2009-10-071-14/+14
| | | | | | | | | * lib/openat.c: Prefer space throughout, rather than mix of 8 spaces vs. tabs. * lib/at-func.c: Likewise. * lib/utimens.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* openat: avoid using wrong fdEric Blake2009-10-071-0/+9
| | | | | | | | | | | | | | Detected by a Solaris failure on: int fd = dup (0); close (fd); mkdirat (fd, "dir", 0700); which created "./dir" instead of failing with EBADF. * lib/openat.c (openat_permissive): Reject user's fd if saving the working directory chooses same fd. * lib/at-func.c (AT_FUNC_NAME): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* openat: simplify use of at-func.cEric Blake2009-09-191-0/+5
| | | | | | | | | | | | | | * lib/at-func.c (includes): Include prerequisites here, to simplify requirements on client files. * lib/openat-priv.h: Add double-inclusion guard. * lib/faccessat.c (includes): Simplify. * lib/fchmodat.c (includes): Likewise. * lib/fchownat.c (includes): Likewise. * lib/mkdirat.c (includes): Likewise. * lib/mkfifoat.c (includes): Likewise. * lib/symlinkat.c (includes): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* symlinkat: new moduleEric Blake2009-09-051-6/+15
| | | | | | | | | | | | | | | | | | * modules/symlinkat: New file. * lib/symlinkat.c: Likewise. * m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witnesses. * modules/unistd (Makefile.am): Use them. * lib/unistd.in.h (symlinkat, readlinkat): Declare them. (faccessat) [GNULIB_POSIXCHECK]: Fix typo. * lib/at-func.c (FUNC_RESULT): New macro, defaulting to int. * MODULES.html.sh (File system functions): Mention module. * doc/posix-functions/symlinkat.texi (symlinkat): Likewise. * doc/posix-functions/readlinkat.texi (readlinkat): Likewise. * modules/symlinkat-tests: New test. * tests/test-symlinkat.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* openat: make template easier to useEric Blake2009-09-031-6/+21
| | | | | | | | | | | | | | | | | * lib/at-func.c (CALL_FUNC): Allow AT_FUNC_USE_F1_COND and AT_FUNC_F2 to be undefined. (VALIDATE_FLAG): New macro; use it to reject bad flags. (AT_FUNC_USE_F1_COND): Change sense to just flag bit. * lib/fchmodat.c (AT_FUNC_USE_F1_COND): Adjust. * lib/fchownat.c (AT_FUNC_USE_F1_COND): Likewise. * lib/openat.c (AT_FUNC_USE_F1_COND) [fstatat, unlinkat]: Likewise. * lib/mkdirat.c (AT_FUNC_F2, AT_FUNC_USE_F1_COND): Delete. * lib/selinux-at.c (AT_FUNC_F2, AT_FUNC_USE_F1_COND) [getfileconat, lgetfileconat, setfileconat, lsetfileconat]: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* [lib/ChangeLog]Paul Eggert2006-09-301-8/+19
| | | | | | | | | | | | | | | | | | | | | | 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).
* Update from coreutils.Paul Eggert2006-08-171-0/+75
* lib/__fpending.h: Add copyright notice. * lib/fprintftime.h: Likewise. * lib/savedir.c: Use (C) in copyright notice. * lib/savedir.h: Likewise. 2006-08-15 Jim Meyering <jim@meyering.net> * lib/at-func.c: New file, with the logic of all emulated at-functions. * lib/openat-priv.h: Include <errno.h> and define ENOSYS, in support of the EXPECTED_ERRNO macro. * lib/openat.c (fstatat, unlinkat, fchownat): Remove function definitions. Instead, define the appropriate symbols and include "at-func.c". * lib/mkdirat.c (mkdirat): Likewise. * lib/fchmodat.c (fchmodat): Likewise. (ENOSYS): Remove definition. * lib/openat.c: Don't include <errno.h>, now that "openat-priv.h" does it. Don't include "unistd--.h" -- it wasn't ever used. 2006-01-17 Jim Meyering <jim@meyering.net> Rewrite fts.c not to change the current working directory, by using openat, fstatat, fdopendir, etc.. * lib/fts.c [! _LIBC]: Include "openat.h" and "unistd--.h". (HAVE_OPENAT_SUPPORT): Define. [_LIBC] (fchdir): Don't undef or define; no longer used. (FCHDIR): Define in terms of cwd_advance_fd rather than fchdir. Now, this `function' always succeeds, and consumes its file descriptor parameter -- so callers must not close such FDs. Update callers. (diropen_fd, opendirat, cwd_advance_fd): New functions. (diropen): Add parameter, SP. Adjust all callers. Implement using diropen_fd, rather than open. (fts_open): Initialize new member, fts_cwd_fd. Remove fts_rft-setting code. (fts_close): Close fts_cwd_fd, if necessary. (__opendir2): Define in terms of opendir or opendirat, depending on whether the FST_NOCHDIR flag is set. (fts_build): Since fts_safe_changedir consumes its FD, and since this code must do `closedir(dirp)', dup the dirfd(dirp) argument, and close the dup'd file descriptor upon failure. (fts_stat): Use fstatat(...AT_SYMLINK_NOFOLLOW) in place of lstat. (fts_safe_changedir): Tweak semantics to reflect that this function now calls cwd_advance_fd and hence consumes its FD argument. * lib/fts_.h [struct FTS] (fts_cwd_fd): New member. [struct FTS] (fts_rft): Remove now-unused member. [struct FTS] (fts_cycle.state): Improve comment. * lib/openat.c (openat_needs_fchdir): New function. * lib/openat.h (openat_needs_fchdir): Declare it. 2006-08-15 Jim Meyering <jim@meyering.net> * m4/openat.m4 (gl_FUNC_OPENAT): Add at-func.c via AC_LIBSOURCES. 2006-01-17 Jim Meyering <jim@meyering.net> * m4/fts.m4 (gl_FUNC_FTS_CORE): Depend on gl_FUNC_OPENAT. 2006-01-11 Jim Meyering <jim@meyering.net> * m4/openat.m4 (gl_FUNC_OPENAT): Require and compile fchmodat.c. Check for the lchmod function.