Age | Commit message (Collapse) | Author |
|
* .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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
and dup to open_safer and dup_safer, respectively.
(openat_permissive): Fix typo in comment.
|
|
"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.
|
|
Remove definitions of macros defined therein.
|
|
|
|
|
|
(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.
|
|
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.
|
|
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
|
|
as second argument to va_arg. Otherwise, some versions of gcc
warn that `if this code is reached, the program will abort'.
|
|
Remove AT_FDCWD test.
Do not consume the fd unless successful.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
in comments or local variable names.
|
|
|
|
|
|
Call free_cwd, to avoid leaking a file descriptor.
|
|
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.
|
|
|
|
|
|
|