mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 08:58:26 +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
|
||||
case vfs.ENOSYS:
|
||||
return -fuse.ENOSYS
|
||||
case vfs.EPERM:
|
||||
return -fuse.EPERM
|
||||
}
|
||||
fs.Errorf(nil, "IO error: %v", err)
|
||||
return -fuse.EIO
|
||||
|
|
|
@ -85,7 +85,9 @@ func translateError(err error) error {
|
|||
case vfs.EROFS:
|
||||
return fuse.Errno(syscall.EROFS)
|
||||
case vfs.ENOSYS:
|
||||
return fuse.Errno(syscall.ENOSYS)
|
||||
return fuse.ENOSYS
|
||||
case vfs.EPERM:
|
||||
return fuse.EPERM
|
||||
}
|
||||
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)
|
||||
if rdwrMode != os.O_RDONLY {
|
||||
fs.Errorf(d, "Can only open directories read only")
|
||||
return nil, os.ErrPermission
|
||||
return nil, EPERM
|
||||
}
|
||||
return newDirHandle(d), nil
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const (
|
|||
var (
|
||||
ENOENT = os.ErrNotExist
|
||||
EEXIST = os.ErrExist
|
||||
EPERM = os.ErrPermission
|
||||
)
|
||||
|
||||
var errorNames = []string{
|
||||
|
|
|
@ -298,10 +298,10 @@ func (f *File) Open(flags int) (fd Handle, err error) {
|
|||
read = false
|
||||
case rdwrMode == os.O_RDWR:
|
||||
fs.Errorf(f, "Can't open for Read and Write")
|
||||
return nil, os.ErrPermission
|
||||
return nil, EPERM
|
||||
default:
|
||||
fs.Errorf(f, "Can't figure out how to open with flags: 0x%X", flags)
|
||||
return nil, os.ErrPermission
|
||||
return nil, EPERM
|
||||
}
|
||||
if read {
|
||||
fd, err = f.OpenRead()
|
||||
|
|
Loading…
Reference in New Issue
Block a user