From fe8e48fc6d5094fe34783b1040b2ae4ba05349b5 Mon Sep 17 00:00:00 2001 From: Zach Koopmans Date: Thu, 4 Nov 2021 14:52:36 -0700 Subject: [syserr] Move ConvertIntr function to linuxerr package Move ConverIntr out of syserr package and delete an unused function. PiperOrigin-RevId: 407676258 --- pkg/errors/linuxerr/internal.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pkg/errors') 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 +} -- cgit v1.2.3