From: Richard Maw Date: Thu, 2 Jul 2015 13:04:34 +0000 (+0000) Subject: util: fall back in rename_noreplace when renameat2 isn't implemented X-Git-Tag: v222~38^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F473%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/util.c b/src/basic/util.c index 727be56f583..a574c9c6611 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