mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
vfs: add EPERM to errors
This commit is contained in:
parent
190367d917
commit
8184ec4b70
|
@ -640,6 +640,8 @@ func translateError(err error) (errc int) {
|
||||||
return -fuse.EROFS
|
return -fuse.EROFS
|
||||||
case vfs.ENOSYS:
|
case vfs.ENOSYS:
|
||||||
return -fuse.ENOSYS
|
return -fuse.ENOSYS
|
||||||
|
case vfs.EPERM:
|
||||||
|
return -fuse.EPERM
|
||||||
}
|
}
|
||||||
fs.Errorf(nil, "IO error: %v", err)
|
fs.Errorf(nil, "IO error: %v", err)
|
||||||
return -fuse.EIO
|
return -fuse.EIO
|
||||||
|
|
|
@ -85,7 +85,9 @@ func translateError(err error) error {
|
||||||
case vfs.EROFS:
|
case vfs.EROFS:
|
||||||
return fuse.Errno(syscall.EROFS)
|
return fuse.Errno(syscall.EROFS)
|
||||||
case vfs.ENOSYS:
|
case vfs.ENOSYS:
|
||||||
return fuse.Errno(syscall.ENOSYS)
|
return fuse.ENOSYS
|
||||||
|
case vfs.EPERM:
|
||||||
|
return fuse.EPERM
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,7 +311,7 @@ func (d *Dir) Open(flags int) (fd Handle, err error) {
|
||||||
rdwrMode := flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)
|
rdwrMode := flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)
|
||||||
if rdwrMode != os.O_RDONLY {
|
if rdwrMode != os.O_RDONLY {
|
||||||
fs.Errorf(d, "Can only open directories read only")
|
fs.Errorf(d, "Can only open directories read only")
|
||||||
return nil, os.ErrPermission
|
return nil, EPERM
|
||||||
}
|
}
|
||||||
return newDirHandle(d), nil
|
return newDirHandle(d), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ const (
|
||||||
var (
|
var (
|
||||||
ENOENT = os.ErrNotExist
|
ENOENT = os.ErrNotExist
|
||||||
EEXIST = os.ErrExist
|
EEXIST = os.ErrExist
|
||||||
|
EPERM = os.ErrPermission
|
||||||
)
|
)
|
||||||
|
|
||||||
var errorNames = []string{
|
var errorNames = []string{
|
||||||
|
|
|
@ -298,10 +298,10 @@ func (f *File) Open(flags int) (fd Handle, err error) {
|
||||||
read = false
|
read = false
|
||||||
case rdwrMode == os.O_RDWR:
|
case rdwrMode == os.O_RDWR:
|
||||||
fs.Errorf(f, "Can't open for Read and Write")
|
fs.Errorf(f, "Can't open for Read and Write")
|
||||||
return nil, os.ErrPermission
|
return nil, EPERM
|
||||||
default:
|
default:
|
||||||
fs.Errorf(f, "Can't figure out how to open with flags: 0x%X", flags)
|
fs.Errorf(f, "Can't figure out how to open with flags: 0x%X", flags)
|
||||||
return nil, os.ErrPermission
|
return nil, EPERM
|
||||||
}
|
}
|
||||||
if read {
|
if read {
|
||||||
fd, err = f.OpenRead()
|
fd, err = f.OpenRead()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user