summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootstrap.conf3
-rw-r--r--m4/jm-macros.m43
-rw-r--r--src/remove.c9
3 files changed, 6 insertions, 9 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 8390ffb0f..9cdfb79d6 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -78,6 +78,7 @@ gnulib_modules="
euidaccess
exclude
exitfail
+ faccessat
fchdir
fcntl
fcntl-safer
@@ -197,7 +198,7 @@ gnulib_modules="
stdlib-safer
stpcpy
stpncpy
- strdup
+ strdup-posix
strftime
strpbrk
strtoimax
diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index 75ee75e2d..f4d43f1dd 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
@@ -92,9 +92,6 @@ AC_DEFUN([coreutils_MACROS],
# for cp.c
AC_CHECK_FUNCS_ONCE([utimensat])
- # for remove.c
- AC_CHECK_FUNCS_ONCE([faccessat])
-
dnl This can't use AC_REQUIRE; I'm not quite sure why.
cu_PREREQ_STAT_PROG
diff --git a/src/remove.c b/src/remove.c
index 2db385909..d6d680316 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -172,12 +172,11 @@ write_protected_non_symlink (int fd_cwd,
mess up with long file names). */
{
- /* Use faccessat if possible, so as to avoid the expense
- of processing an N-component name. */
-#if HAVE_FACCESSAT && AT_EACCESS
- if (faccessat (fd_cwd, file, W_OK, AT_EACCESS) == 0)
+ /* This implements #1: on decent systems, either faccessat is
+ native or /proc/self/fd allows us to skip a chdir. */
+ if (!openat_needs_fchdir ()
+ && faccessat (fd_cwd, file, W_OK, AT_EACCESS) == 0)
return 0;
-#endif
/* This implements #5: */
size_t file_name_len = strlen (full_name);