mirror of https://github.com/golang/go.git
internal/poll: use ignoringEINTR2 in (*FD).Pread
Change-Id: I2af5f3f039b6c0e8e77484bd6b2cdb88e919a85d Reviewed-on: https://go-review.googlesource.com/c/go/+/641759 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
cc874072f3
commit
9896da303a
|
|
@ -183,16 +183,9 @@ func (fd *FD) Pread(p []byte, off int64) (int, error) {
|
|||
if fd.IsStream && len(p) > maxRW {
|
||||
p = p[:maxRW]
|
||||
}
|
||||
var (
|
||||
n int
|
||||
err error
|
||||
)
|
||||
for {
|
||||
n, err = syscall.Pread(fd.Sysfd, p, off)
|
||||
if err != syscall.EINTR {
|
||||
break
|
||||
}
|
||||
}
|
||||
n, err := ignoringEINTR2(func() (int, error) {
|
||||
return syscall.Pread(fd.Sysfd, p, off)
|
||||
})
|
||||
if err != nil {
|
||||
n = 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue