From ec38a9c783fcca2c9402510f1d355dcfa2e7471d Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Tue, 24 Jun 2014 16:13:49 -0400 Subject: [PATCH] fix rename'ing to local device --- src/fs.cpp | 10 +++++----- src/rename.cpp | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fs.cpp b/src/fs.cpp index 86f3564c..6bf69196 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -136,12 +136,12 @@ namespace fs string make_path(const string base, - const string fusepath) + const string suffix) { - if(*base.rbegin() == '/' || - *fusepath.rbegin() == '/') - return base + fusepath; - return base + '/' + fusepath; + if(suffix[0] == '/' || + *base.rbegin() == '/') + return base + suffix; + return base + '/' + suffix; } bool diff --git a/src/rename.cpp b/src/rename.cpp index 99cfae93..fbc61a54 100644 --- a/src/rename.cpp +++ b/src/rename.cpp @@ -57,6 +57,8 @@ _rename(const fs::SearchFunc searchFunc, pathto = fs::make_path(pathfrom[0].base,to); rv = ::rename(pathfrom[0].full.c_str(),pathto.c_str()); + if(rv == -1 && errno == ENOENT) + return -EXDEV; return ((rv == -1) ? -errno : 0); }