Merge pull request #473 from richardmaw-codethink/machinectl-import-earlier-than-3-15

util: fall back in rename_noreplace when renameat2 isn't implemented
This commit is contained in:
Lennart Poettering 2015-07-03 10:11:33 +02:00
commit 200edc2bcf

View file

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