mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-23 15:33:16 +08:00
Retry direct unix package calls if observing EINTR
Retry Recvfrom, Sendmsg, Readmsg, and Read as they can return EINTR. Signed-off-by: Evan Phoenix <evan@phx.io>
This commit is contained in:
@@ -2,6 +2,7 @@ package libcontainer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"unsafe"
|
||||
|
||||
@@ -40,7 +41,11 @@ func registerMemoryEventV2(cgDir, evName, cgEvName string) (<-chan struct{}, err
|
||||
|
||||
for {
|
||||
n, err := unix.Read(fd, buffer[:])
|
||||
if err == unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
err = os.NewSyscallError("read", err)
|
||||
logrus.Warnf("unable to read event data from inotify, got error: %v", err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user