rewrite SMTPFileSystem::open()

This commit is contained in:
Peter Hatina 2013-09-24 21:55:26 +02:00
parent 4bab7cddd3
commit 63035618f8
1 changed files with 8 additions and 3 deletions

View File

@ -596,13 +596,18 @@ int SMTPFileSystem::open(const char *path, struct fuse_file_info *file_info)
std::string tmp_file = m_tmp_files_pool.makeTmpPath(std::string(path));
int rval = m_device.filePull(std::string(path), tmp_file);
if (rval != 0)
return rval;
if (rval != 0) {
errno = rval;
return -1;
}
int fd = ::open(tmp_file.c_str(), file_info->flags);
if (fd < 0)
return -errno;
return -1;
file_info->fh = fd;
m_tmp_files_pool.addFile(TypeTmpFile(std::string(path), tmp_file, fd));
return 0;
}