Skip to content

Commit e64675a

Browse files
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 <[email protected]>
1 parent 2cd2ff6 commit e64675a

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/os/file_unix.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,8 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
202202
break
203203
}
204204

205-
// On OS X, sigaction(2) doesn't guarantee that SA_RESTART will cause
206-
// open(2) to be restarted for regular files. This is easy to reproduce on
207-
// fuse file systems (see https://golang.org/issue/11180).
208-
if runtime.GOOS == "darwin" && e == syscall.EINTR {
205+
// We have to check EINTR here, per issues 11180 and 39237.
206+
if e == syscall.EINTR {
209207
continue
210208
}
211209

src/os/removeall_at.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package os
99
import (
1010
"internal/syscall/unix"
1111
"io"
12-
"runtime"
1312
"syscall"
1413
)
1514

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

180179
// See comment in openFileNolog.
181-
if runtime.GOOS == "darwin" && e == syscall.EINTR {
180+
if e == syscall.EINTR {
182181
continue
183182
}
184183

0 commit comments

Comments
 (0)