diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-03-18 19:25:33 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-18 19:25:33 +0000 |
commit | b6af86bbc2afd436c049133676045574d3906d3a (patch) | |
tree | 13f26350551710b95221ffd257d491ac62f38c4d /pkg/syserror/syserror.go | |
parent | d3a3fe04cccfe8646a4ec8bf9dda0689cf524e07 (diff) | |
parent | 7fac7e32f3a866134bcee499dfc64459946dfe9d (diff) |
Merge release-20210309.0-41-g7fac7e32f (automated)
Diffstat (limited to 'pkg/syserror/syserror.go')
-rw-r--r-- | pkg/syserror/syserror.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pkg/syserror/syserror.go b/pkg/syserror/syserror.go index 97de17afe..56b621357 100644 --- a/pkg/syserror/syserror.go +++ b/pkg/syserror/syserror.go @@ -130,17 +130,15 @@ func AddErrorUnwrapper(unwrap func(e error) (unix.Errno, bool)) { // TranslateError translates errors to errnos, it will return false if // the error was not registered. func TranslateError(from error) (unix.Errno, bool) { - err, ok := errorMap[from] - if ok { - return err, ok + if err, ok := errorMap[from]; ok { + return err, true } // Try to unwrap the error if we couldn't match an error // exactly. This might mean that a package has its own // error type. for _, unwrap := range errorUnwrappers { - err, ok := unwrap(from) - if ok { - return err, ok + if err, ok := unwrap(from); ok { + return err, true } } return 0, false |