The fix is in the attached patch.
>From d4720c44fb2c8c2b891bd07fbf6d44a2333f8c56 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.vol...@rusbitech.ru>
Date: Wed, 29 Aug 2018 13:54:23 +0300
Subject: [PATCH] fix opening a file with O_CREAT and reading created files

FUSE calls fgetattr() for a created file which leads to calling
smbc_fstat() that fails. This is probably a bug in libsmbclient.
Besides smbc_read() fails for a file opened/created with smbc_create().

As a workaround don't register "create" function in FUSE, "open"
is sufficient.

https://bugs.debian.org/892841
---
 src/function.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/src/function.c b/src/function.c
index 3e88f42..5536209 100644
--- a/src/function.c
+++ b/src/function.c
@@ -90,19 +90,6 @@ static int function_open(const char *path, struct fuse_file_info *fi){
     return 0;
 }
 
-static int function_creat(const char *path, mode_t mode,
-			struct fuse_file_info *fi){
-    samba_fd	fd;
-
-    DPRINTF(5, "(%s, mode=%0x, flags=%o, fh=%llx)\n", path, mode,
-	fi->flags, (long long) fi->fh);
-    if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
-
-    if ((fd = samba_creat(path, fi->flags)) == NULL) return -errno;
-    function_store_fd(fi, fd);
-    return 0;
-}
-
 static int function_read(const char *path, char *buf, size_t size, off_t offset,
 			struct fuse_file_info *fi){
     int		result;
@@ -589,7 +576,6 @@ static int function_statfs(const char *path, struct statvfs *stbuf){
 
 struct fuse_operations smb_oper = {
     .open	= function_open,
-    .create	= function_creat,
     .read	= function_read,
     .write	= function_write,
     .release	= function_close,
-- 
2.17.0


Reply via email to