From 826538bf64c5a11b69167a19b70697e9e0481e43 Mon Sep 17 00:00:00 2001 From: "G.raud Meyer" Date: Mon, 9 Apr 2018 15:35:40 +0200 Subject: [PATCH] rename: skip faccessat() failure if AT_SYMLINK_NOFOLLOW is not a valid flag AT_SYMLINK_NOFOLLOW is not required by POSIX and it is not a valid flag on Mac OSX. --- misc-utils/rename.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc-utils/rename.c b/misc-utils/rename.c index 9983ad2a9d..8f5d41a695 100644 --- a/misc-utils/rename.c +++ b/misc-utils/rename.c @@ -60,7 +60,11 @@ static int do_symlink(char *from, char *to, char *s, int verbose, int noact, int int ret = 1; struct stat sb; - if (faccessat(AT_FDCWD, s, F_OK, AT_SYMLINK_NOFOLLOW) != 0) { + if ( faccessat(AT_FDCWD, s, F_OK, AT_SYMLINK_NOFOLLOW) != 0 && + errno != EINVAL ) + /* Skip if AT_SYMLINK_NOFOLLOW is not supported; lstat() below will + detect the access error */ + { warn(_("%s: not accessible"), s); return 2; } -- 2.39.5