os: always check for EINTR in calls to open

For #11180
For #20400
For #39237

Change-Id: I8de97517c8f92c08f0c8a51f651a17e31617979b
Reviewed-on: https://go-review.googlesource.com/c/go/+/236997
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Ian Lance Taylor 2020-06-08 14:35:07 -07:00
parent 2cd2ff6f56
commit e64675a79f
2 changed files with 3 additions and 6 deletions

View file

@ -202,10 +202,8 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
break
}
// On OS X, sigaction(2) doesn't guarantee that SA_RESTART will cause
// open(2) to be restarted for regular files. This is easy to reproduce on
// fuse file systems (see https://golang.org/issue/11180).
if runtime.GOOS == "darwin" && e == syscall.EINTR {
// We have to check EINTR here, per issues 11180 and 39237.
if e == syscall.EINTR {
continue
}