cmount: fix error handling for Open/OpenDir

This commit is contained in:
Nick Craig-Wood 2018-03-21 11:13:17 +00:00
parent f6020f1308
commit 4f6f07c074

View File

@ -204,7 +204,7 @@ func (fsys *FS) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int) {
func (fsys *FS) Opendir(path string) (errc int, fh uint64) {
defer log.Trace(path, "")("errc=%d, fh=0x%X", &errc, &fh)
handle, err := fsys.VFS.OpenFile(path, os.O_RDONLY, 0777)
if errc != 0 {
if err != nil {
return translateError(err), fhUnset
}
return 0, fsys.openHandle(handle)
@ -285,7 +285,7 @@ func (fsys *FS) Open(path string, flags int) (errc int, fh uint64) {
// translate the fuse flags to os flags
flags = translateOpenFlags(flags)
handle, err := fsys.VFS.OpenFile(path, flags, 0777)
if errc != 0 {
if err != nil {
return translateError(err), fhUnset
}