summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/remove.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remove.c b/src/remove.c
index 32f67a181..2db385909 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -172,6 +172,13 @@ 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)
+ return 0;
+#endif
+
/* This implements #5: */
size_t file_name_len = strlen (full_name);