From df4f266dab48422d40020be1a58842f66cc90717 Mon Sep 17 00:00:00 2001 From: Florent Viard Date: Fri, 5 May 2017 15:29:57 +0200 Subject: [PATCH] Fixes invalid returned fuse errors: - + - = + Functions in "mtp-device.cpp" already return a "negative" errno value, so no need to return "-rval" (negative rval) in fuse.cpp. Visible effect: real error returned by fuse like "No such files or directories ENOENT" instead of ERANGE. --- src/simple-mtpfs-fuse.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/simple-mtpfs-fuse.cpp b/src/simple-mtpfs-fuse.cpp index 588968d..17e3d97 100644 --- a/src/simple-mtpfs-fuse.cpp +++ b/src/simple-mtpfs-fuse.cpp @@ -493,15 +493,15 @@ int SMTPFileSystem::rename(const char *path, const char *newpath) const std::string tmp_file = m_tmp_files_pool.makeTmpPath(std::string(newpath)); int rval = m_device.filePull(std::string(path), tmp_file); if (rval != 0) - return -rval; + return rval; rval = m_device.filePush(tmp_file, std::string(newpath)); if (rval != 0) - return -rval; + return rval; rval = m_device.fileRemove(std::string(path)); if (rval != 0) - return -rval; + return rval; return 0; } @@ -522,7 +522,7 @@ int SMTPFileSystem::truncate(const char *path, off_t new_size) int rval = m_device.filePull(std::string(path), tmp_path); if (rval != 0) { ::unlink(tmp_path.c_str()); - return -rval; + return rval; } rval = ::truncate(tmp_path.c_str(), new_size); @@ -535,14 +535,14 @@ int SMTPFileSystem::truncate(const char *path, off_t new_size) rval = m_device.fileRemove(std::string(path)); if (rval != 0) { ::unlink(tmp_path.c_str()); - return -rval; + return rval; } rval = m_device.filePush(tmp_path, std::string(path)); ::unlink(tmp_path.c_str()); if (rval != 0) - return -rval; + return rval; return 0; } @@ -598,7 +598,7 @@ int SMTPFileSystem::open(const char *path, struct fuse_file_info *file_info) int rval = m_device.filePull(std_path, tmp_path); if (rval != 0) - return -rval; + return rval; } int fd = ::open(tmp_path.c_str(), file_info->flags); @@ -664,7 +664,7 @@ int SMTPFileSystem::release(const char *path, struct fuse_file_info *file_info) rval = m_device.filePush(tmp_path, std_path); if (rval != 0) { ::unlink(tmp_path.c_str()); - return -rval; + return rval; } }