summaryrefslogtreecommitdiffhomepage
path: root/pkg/syserr/syserr.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/syserr/syserr.go')
-rw-r--r--pkg/syserr/syserr.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/syserr/syserr.go b/pkg/syserr/syserr.go
index 7d0a5125b..558240008 100644
--- a/pkg/syserr/syserr.go
+++ b/pkg/syserr/syserr.go
@@ -22,6 +22,7 @@ import (
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/abi/linux/errno"
+ "gvisor.dev/gvisor/pkg/errors"
"gvisor.dev/gvisor/pkg/errors/linuxerr"
"gvisor.dev/gvisor/pkg/syserror"
)
@@ -51,7 +52,7 @@ func New(message string, linuxTranslation errno.Errno) *Error {
}
e := error(unix.Errno(err.errno))
- // syserror.ErrWouldBlock gets translated to syserror.EWOULDBLOCK and
+ // syserror.ErrWouldBlock gets translated to linuxerr.EWOULDBLOCK and
// enables proper blocking semantics. This should temporary address the
// class of blocking bugs that keep popping up with the current state of
// the error space.
@@ -281,6 +282,11 @@ func FromError(err error) *Error {
if errno, ok := err.(unix.Errno); ok {
return FromHost(errno)
}
+
+ if linuxErr, ok := err.(*errors.Error); ok {
+ return FromHost(unix.Errno(linuxErr.Errno()))
+ }
+
if errno, ok := syserror.TranslateError(err); ok {
return FromHost(errno)
}