# 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
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);