summaryrefslogtreecommitdiff
path: root/lib/openat.c
AgeCommit message (Collapse)Author
2006-08-15[./]Jim Meyering
* .x-sc_require_config_h: Add lib/at-func.c. [lib/] * at-func.c: New file, with the logic of all emulated at-functions. * openat-priv.h: Include <errno.h> and define ENOSYS, in support of the EXPECTED_ERRNO macro. * openat.c (fstatat, unlinkat, fchownat): Remove function definitions. Instead, define the appropriate symbols and include "at-func.c". * mkdirat.c (mkdirat): Likewise. * fchmodat.c (fchmodat): Likewise. (ENOSYS): Remove definition. * openat.c: Don't include <errno.h>, now that "openat-priv.h" does it. Don't include "unistd--.h" -- it wasn't ever used. [m4/] * openat.m4 (gl_FUNC_OPENAT): Add at-func.c via AC_LIBSOURCES.
2006-06-20(openat): Use ?:, not if, to work around GCC bug 4210.Paul Eggert
2006-06-20fix typo in comment: s/nerrower/narrower/Jim Meyering
2006-02-16Include lstat.h, so that uses of lstat are convertedJim Meyering
to uses of rpl_lstat, e.g., on Solaris 9. Otherwise, programs like du (which now uses the openat-enabled fts and hence fstatat) would mistakenly fail to dereference a symlink-to-directory specified with a trailing slash.
2006-01-17(openat_needs_fchdir): New function.Jim Meyering
2006-01-11(fchownat): New function.Jim Meyering
2005-12-22Include "fcntl--.h" and "unistd--.h", to map openJim Meyering
and dup to open_safer and dup_safer, respectively. (openat_permissive): Fix typo in comment.
2005-12-17Don't include <stdlib.h>, <unistd.h>, <fcntl.h>,Paul Eggert
"gettext.h"; either no longer needed or are guaranteed by openat.h. (_): Remove; no longer needed. (openat): Renamed from rpl_openat; no need for rpl_openat since openat.h renames openat for us. Replace most of the body with a call to openat_permissive, to avoid duplicate code. Port to (probably hypothetical) environments were mode_t is wider than int. (openat_permissive): Require mode arg, so that we can check types better. Put it just after flags. Change cwd failure indicator from pointer-to-bool to pointer-to-errno-value. All callers changed. Invoke openat_save_fail and/or openat_restore_fail if cwd_errno is null, so that openat can call us. (openat_permissive, fdopendir, fstatat, unlinkat): Simplify errno handling to avoid some duplicate code, as it's OK to set errno on success.
2005-11-30Include openat-priv.h.Jim Meyering
Remove definitions of macros defined therein.
2005-11-23tweak grammar in commentsJim Meyering
2005-11-23(fdopendir): Don't change errno when returning non-NULL.Jim Meyering
2005-11-22(EXPECTED_ERRNO): New macro.Jim Meyering
(openat_permissive): New function -- used in remove.c rewrite. (all functions): Set errno just before returning, only if there was an actual failure. Use EXPECTED_ERRNO rather than comparing against only ENOTDIR.
2005-11-12Emulate openat-family functions using Linux's procfs, if possible.Jim Meyering
Idea and some code from Ulrich Drepper's glibc changes. (BUILD_PROC_NAME): New macro. Include <stdio.h>, <string.h>, "alloca.h" and "intprops.h". (rpl_openat): Emulate by trying to open /proc/self/fd/%d/%s, before falling back on save_cwd and restore_cwd. (fdopendir, fstatat, unlinkat): Likewise.
2005-11-10(fstatat, unlinkat): Perform the syscall directly,Jim Meyering
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
2005-10-08(rpl_openat): Use the promoted type (int), not mode_t,Jim Meyering
as second argument to va_arg. Otherwise, some versions of gcc warn that `if this code is reached, the program will abort'.
2005-09-30(fdopendir): Do not define if HAVE_FDOPENDIR.Jim Meyering
Remove AT_FDCWD test. Do not consume the fd unless successful.
2005-09-22Sync from gnulib.Paul Eggert
2005-09-20(fdopendir): Be sure to close the suppliedJim Meyering
file descriptor before returning. This makes our replacement implementation a little closer to Solaris's, where fdopendir ties the file descriptor to the returned DIR* pointer.
2005-09-19(unlinkat): New function.Jim Meyering
2005-06-14Reflect s/_die/_fail/ renaming.Jim Meyering
2005-06-14Provide an alternative to exiting immediately upon save_cwd orJim Meyering
restore_cwd failure. Now, an application can arrange e.g., to perform a longjump in that case. * openat.c: Include dirname.h. Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash. (rpl_openat, fdopendir, fstatat): Call openat_save_die and openat_restore_die rather than calling error directly. Don't include "error.h" or "exitfail.h"; they're no longer needed. * openat-die.c (openat_save_die, openat_restore_die): New file. * openat.h (openat_save_die, openat_restore_die): Declare and define.
2005-06-02Don't use "path" or "filename" to mean "file name"Paul Eggert
in comments or local variable names.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-01-19(fdopendir, fstatat): New functions.Jim Meyering
2004-12-31(rpl_openat): Correct comment.Jim Meyering
Call free_cwd, to avoid leaking a file descriptor.
2004-12-03Include "openat.h" before other include files.Paul Eggert
Include "exitfail.h". (openat): Remove #undef; no longer needed now that we include openat.h first. (rpl_openat): Add comment about mode_t promotion. Simplify code a bit by moving initializations around. Use exit_failure rather than EXIT_FAILURE.
2004-11-28(rpl_openat): Also accept optional mode parameter.Jim Meyering
2004-11-28*** empty log message ***Jim Meyering
2004-11-28*** empty log message ***Jim Meyering