mirror of
https://github.com/golang/go
synced 2024-09-28 17:14:29 -06:00
os: use ignoringEINTR in openFileNolog and openDirNolog
Change-Id: Ie8fa25d5e326efd7d3c9b72203783110d9e22ce8 Reviewed-on: https://go-review.googlesource.com/c/go/+/572215 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
d14cf8f91b
commit
207511a0d4
@ -265,20 +265,17 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
|
||||
}
|
||||
}
|
||||
|
||||
var r int
|
||||
var s poll.SysFile
|
||||
for {
|
||||
var e error
|
||||
var (
|
||||
r int
|
||||
s poll.SysFile
|
||||
e error
|
||||
)
|
||||
// We have to check EINTR here, per issues 11180 and 39237.
|
||||
ignoringEINTR(func() error {
|
||||
r, s, e = open(name, flag|syscall.O_CLOEXEC, syscallMode(perm))
|
||||
if e == nil {
|
||||
break
|
||||
}
|
||||
|
||||
// We have to check EINTR here, per issues 11180 and 39237.
|
||||
if e == syscall.EINTR {
|
||||
continue
|
||||
}
|
||||
|
||||
return e
|
||||
})
|
||||
if e != nil {
|
||||
return nil, &PathError{Op: "open", Path: name, Err: e}
|
||||
}
|
||||
|
||||
@ -304,19 +301,16 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
|
||||
}
|
||||
|
||||
func openDirNolog(name string) (*File, error) {
|
||||
var r int
|
||||
var s poll.SysFile
|
||||
for {
|
||||
var e error
|
||||
var (
|
||||
r int
|
||||
s poll.SysFile
|
||||
e error
|
||||
)
|
||||
ignoringEINTR(func() error {
|
||||
r, s, e = open(name, O_RDONLY|syscall.O_CLOEXEC, 0)
|
||||
if e == nil {
|
||||
break
|
||||
}
|
||||
|
||||
if e == syscall.EINTR {
|
||||
continue
|
||||
}
|
||||
|
||||
return e
|
||||
})
|
||||
if e != nil {
|
||||
return nil, &PathError{Op: "open", Path: name, Err: e}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user