summaryrefslogtreecommitdiffhomepage
path: root/pkg/errors
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2021-11-04 14:52:36 -0700
committergVisor bot <gvisor-bot@google.com>2021-11-04 14:55:52 -0700
commitfe8e48fc6d5094fe34783b1040b2ae4ba05349b5 (patch)
tree3d532abd71a834b5bfc3af57b34db1609c8d028c /pkg/errors
parent23a115dae84e7e63c8785c49dfff3e551a0bf97e (diff)
[syserr] Move ConvertIntr function to linuxerr package
Move ConverIntr out of syserr package and delete an unused function. PiperOrigin-RevId: 407676258
Diffstat (limited to 'pkg/errors')
-rw-r--r--pkg/errors/linuxerr/internal.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/errors/linuxerr/internal.go b/pkg/errors/linuxerr/internal.go
index 127bba0df..87d9ec59c 100644
--- a/pkg/errors/linuxerr/internal.go
+++ b/pkg/errors/linuxerr/internal.go
@@ -118,3 +118,12 @@ func SyscallRestartErrorFromReturn(rv uintptr) (*errors.Error, bool) {
err, ok := restartMap[int(rv)]
return err, ok
}
+
+// ConvertIntr converts the provided error code (err) to another one (intr) if
+// the first error corresponds to an interrupted operation.
+func ConvertIntr(err, intr error) error {
+ if err == ErrInterrupted {
+ return intr
+ }
+ return err
+}