From f85ef957e647c5182acf5e64298f68e4b7fbfe8f Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Tue, 10 Mar 2015 18:15:52 +0100 Subject: util: add rename_noreplace renameat2() exists since Linux 3.15 but btrfs support for the flag RENAME_NOREPLACE was added later. This patch implements a fallback when renameat2() returns EINVAL. EINVAL is the error returned when the filesystem does not support one of the flags. --- src/shared/util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/shared/util.h') diff --git a/src/shared/util.h b/src/shared/util.h index d2da3e2895..d229e1e68c 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -1081,3 +1081,5 @@ void sigkill_wait(pid_t *pid); int syslog_parse_priority(const char **p, int *priority, bool with_facility); void cmsg_close_all(struct msghdr *mh); + +int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); -- cgit v1.2.3-54-g00ecf