summaryrefslogtreecommitdiffstats
path: root/misc-utils/rename.c
diff options
context:
space:
mode:
authorG.raud Meyer2018-04-09 15:35:40 +0200
committerG.raud Meyer2018-04-09 15:41:30 +0200
commit826538bf64c5a11b69167a19b70697e9e0481e43 (patch)
tree10c0d4059907e375b45dd3fdbdfd5897387bb405 /misc-utils/rename.c
parentrename: check source file access early (diff)
downloadkernel-qcow2-util-linux-826538bf64c5a11b69167a19b70697e9e0481e43.tar.gz
kernel-qcow2-util-linux-826538bf64c5a11b69167a19b70697e9e0481e43.tar.xz
kernel-qcow2-util-linux-826538bf64c5a11b69167a19b70697e9e0481e43.zip
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.
Diffstat (limited to 'misc-utils/rename.c')
-rw-r--r--misc-utils/rename.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 9983ad2a9..8f5d41a69 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;
}