Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes invalid returned fuse errors: - + - = + #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/simple-mtpfs-fuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}

Expand Down