Commit 629a0d43 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Convert os.PathError back to syscall errno as well.

parent 29789cbd
......@@ -45,6 +45,11 @@ func OsErrorToFuseError(err os.Error) Status {
return Status(asSyscallErr.Errno)
}
asPathErr, ok := err.(*os.PathError)
if ok {
return OsErrorToFuseError(asPathErr.Error)
}
// Should not happen. Should we log an error somewhere?
return ENOSYS
}
......
......@@ -18,4 +18,10 @@ func TestOsErrorToFuseError(t *testing.T) {
if errNo != syscall.EPERM {
t.Errorf("Wrong conversion %v != %v", errNo, syscall.EPERM)
}
e = os.Remove("this-file-surely-does-not-exist")
errNo = OsErrorToFuseError(e)
if errNo != syscall.ENOENT {
t.Errorf("Wrong conversion %v != %v", errNo, syscall.ENOENT)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment