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/import/pull-raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/import/pull-raw.c') diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c index d1d77d598b..c0c6d57ead 100644 --- a/src/import/pull-raw.c +++ b/src/import/pull-raw.c @@ -384,9 +384,9 @@ static void raw_pull_job_on_finished(PullJob *j) { if (r < 0) goto finish; - r = renameat2(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path, RENAME_NOREPLACE); + r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path); if (r < 0) { - r = log_error_errno(errno, "Failed to move RAW file into place: %m"); + log_error_errno(r, "Failed to move RAW file into place: %m"); goto finish; } -- cgit v1.2.3-54-g00ecf