From 4bab7cddd3e77b3eb93f56dbe4280d6290a4e4a4 Mon Sep 17 00:00:00 2001 From: Peter Hatina Date: Tue, 24 Sep 2013 21:48:40 +0200 Subject: [PATCH] rewrite SMTPFileSystem::create() --- src/simple-mtpfs-fuse.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/simple-mtpfs-fuse.cpp b/src/simple-mtpfs-fuse.cpp index 9023a35..b6fd643 100644 --- a/src/simple-mtpfs-fuse.cpp +++ b/src/simple-mtpfs-fuse.cpp @@ -577,12 +577,15 @@ int SMTPFileSystem::utime(const char *path, struct utimbuf *ubuf) int SMTPFileSystem::create(const char *path, mode_t mode, fuse_file_info *file_info) { const std::string tmp_path = m_tmp_files_pool.makeTmpPath(std::string(path)); + int rval = ::creat(tmp_path.c_str(), mode); if (rval < 0) - return -errno; + return -1; + file_info->fh = rval; m_tmp_files_pool.addFile(TypeTmpFile(std::string(path), tmp_path, rval, true)); m_device.filePush(tmp_path, std::string(path)); + return 0; }