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.
This commit is contained in:
G.raud Meyer 2018-04-09 15:35:40 +02:00
parent 5454df9c31
commit 826538bf64
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}