summaryrefslogtreecommitdiff
path: root/src/basic/util.c
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-07-02 13:04:34 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2015-07-02 14:47:04 +0100
commit715d7599051602471d4a54bbc00639d32ddaaae2 (patch)
tree8a15fb457c93ddcfc1a98c0d8fd3d7010f69c428 /src/basic/util.c
parent9ebdb1e057045d2b96f5980c61667cd41914177b (diff)
util: fall back in rename_noreplace when renameat2 isn't implemented
According to README we only need 3.7, and while it may also make sense to bump that requirement when appropriate, it's trivial to fall back when renameat2 is not available.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r--src/basic/util.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index 727be56f58..a574c9c661 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -5925,10 +5925,9 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char
if (ret >= 0)
return 0;
- /* Even though renameat2() exists since Linux 3.15, btrfs added
- * support for it later. If it is not implemented, fallback to another
- * method. */
- if (errno != EINVAL)
+ /* renameat2() exists since Linux 3.15, btrfs added support for it later.
+ * If it is not implemented, fallback to another method. */
+ if (!IN_SET(errno, EINVAL, ENOSYS))
return -errno;
/* The link()/unlink() fallback does not work on directories. But