]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rename: skip faccessat() failure if AT_SYMLINK_NOFOLLOW is not a valid flag
authorG.raud Meyer <graud@gmx.com>
Mon, 9 Apr 2018 13:35:40 +0000 (15:35 +0200)
committerG.raud Meyer <graud@gmx.com>
Mon, 9 Apr 2018 13:41:30 +0000 (15:41 +0200)
AT_SYMLINK_NOFOLLOW is not required by POSIX and it is not a valid flag
on Mac OSX.

misc-utils/rename.c

index 9983ad2a9d8f2e8079f319fa9dd7c1b28fec5131..8f5d41a695c98319c94d5aa9fea272f5a9b83faa 100644 (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;
        }