rewrite SMTPFileSystem::write()
This commit is contained in:
parent
a58979a904
commit
9f3c2f511c
|
@ -623,12 +623,16 @@ int SMTPFileSystem::read(const char *path, char *buf, size_t size,
|
||||||
int SMTPFileSystem::write(const char *path, const char *buf, size_t size,
|
int SMTPFileSystem::write(const char *path, const char *buf, size_t size,
|
||||||
off_t offset, struct fuse_file_info *file_info)
|
off_t offset, struct fuse_file_info *file_info)
|
||||||
{
|
{
|
||||||
|
const TypeTmpFile *tmp_file = m_tmp_files_pool.getFile(static_cast<int>(file_info->fh));
|
||||||
|
if (!tmp_file) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int rval = ::pwrite(file_info->fh, buf, size, offset);
|
int rval = ::pwrite(file_info->fh, buf, size, offset);
|
||||||
if (rval < 0)
|
if (rval < 0)
|
||||||
return -errno;
|
return -1;
|
||||||
const TypeTmpFile *tmp_file = m_tmp_files_pool.getFile(static_cast<int>(file_info->fh));
|
|
||||||
if (!tmp_file)
|
|
||||||
return -EINVAL;
|
|
||||||
const_cast<TypeTmpFile*>(tmp_file)->setModified();
|
const_cast<TypeTmpFile*>(tmp_file)->setModified();
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue