summaryrefslogtreecommitdiffhomepage
path: root/pkg/errors
diff options
context:
space:
mode:
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
+}