Added FUSE support #55

Merged
Elara6331 merged 65 commits from yannickulrich/itd:fuse into master 2023-03-25 22:23:52 +00:00
Showing only changes of commit c142d97ee8 - Show all commits

View File

@ -335,6 +335,8 @@ func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle,
return nil, 0, syscall.EROFS return nil, 0, syscall.EROFS
} }
defer fp.Close()
buf := make([]byte, f.self.size); buf := make([]byte, f.self.size);
nread, err := fp.Read(buf) nread, err := fp.Read(buf)
if err != nil || nread != int(f.self.size) { if err != nil || nread != int(f.self.size) {
@ -342,11 +344,6 @@ func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle,
fp.Close() fp.Close()
return nil, 0, syscall.EROFS return nil, 0, syscall.EROFS
} }
err = fp.Close()
if err != nil {
log.Error("Closing file failed").Str("path", f.path).Err(err).Send();
return nil, 0, syscall.EROFS
}
fh = &bytesFileReadHandle{ fh = &bytesFileReadHandle{
content: buf, content: buf,