Prevent operations on a file once it's closed
This commit is contained in:
@@ -11,6 +11,7 @@ var (
|
||||
ErrFileWriteOnly = errors.New("file is write only")
|
||||
ErrInvalidOffset = errors.New("offset out of range")
|
||||
ErrNoRemoveRoot = errors.New("refusing to remove root directory")
|
||||
ErrFileClosed = errors.New("cannot perform operation on a closed file")
|
||||
)
|
||||
|
||||
// Error represents an error returned by BLE FS
|
||||
|
||||
@@ -61,6 +61,8 @@ func syscallErr(err error) syscall.Errno {
|
||||
return syscall.EINVAL
|
||||
case fsproto.ErrNoRemoveRoot: // refusing to remove root directory
|
||||
return syscall.EPERM
|
||||
case fsproto.ErrFileClosed: // cannot perform operation on closed file
|
||||
return syscall.EBADF
|
||||
default:
|
||||
return syscall.EINVAL
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user