Refactor spots to make use of sys.IgnoringEintr

This makes use of pkg/sys's IgnoringEintr function
to clean up some of the redundant eintr loops we
had laying around.

Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
Danny Canter
2024-04-10 04:15:55 -07:00
parent 3ea69db8e9
commit b50e9eae43
4 changed files with 39 additions and 77 deletions

View File

@@ -190,13 +190,9 @@ func getUsernsFD(uidMaps, gidMaps []syscall.SysProcIDMap) (_usernsFD *os.File, r
}
func pidfdWaitid(pidFD *os.File) error {
for {
err := unix.Waitid(unix.P_PIDFD, int(pidFD.Fd()), nil, unix.WEXITED, nil)
if err == unix.EINTR {
continue
}
return err
}
return sys.IgnoringEINTR(func() error {
return unix.Waitid(unix.P_PIDFD, int(pidFD.Fd()), nil, unix.WEXITED, nil)
})
}
var (