Skip to content

Commit

Permalink
os: always check for EINTR in calls to open
Browse files Browse the repository at this point in the history
For golang#11180
For golang#20400
For golang#39237

Change-Id: I8de97517c8f92c08f0c8a51f651a17e31617979b
Reviewed-on: https://go-review.googlesource.com/c/go/+/236997
Reviewed-by: Bryan C. Mills <bcmills@google.com>
  • Loading branch information
ianlancetaylor committed Jun 8, 2020
1 parent 2cd2ff6 commit e64675a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/os/file_unix.go
Expand Up @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions src/os/removeall_at.go
Expand Up @@ -9,7 +9,6 @@ package os
import (
"internal/syscall/unix"
"io"
"runtime"
"syscall"
)

Expand Down Expand Up @@ -178,7 +177,7 @@ func openFdAt(dirfd int, name string) (*File, error) {
}

// See comment in openFileNolog.
if runtime.GOOS == "darwin" && e == syscall.EINTR {
if e == syscall.EINTR {
continue
}

Expand Down

0 comments on commit e64675a

Please sign in to comment.