Skip to content

Commit 047a326

Browse files
oioojianlancetaylor
authored andcommitted
[release-branch.go1.12] os: enable the close-on-exec flag for openFdAt
There's a race here with fork/exec, enable the close-on-exec flag for the new file descriptor. Updates #33405 Fixes #33424 Change-Id: Ib1e405c3b48b11c867f183fd13eff8b73d95e3b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/188537 Run-TryBot: Baokun Lee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit 2d6ee6e) Reviewed-on: https://go-review.googlesource.com/c/go/+/188538 Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent 3c97797 commit 047a326

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/os/removeall_at.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func openFdAt(dirfd int, name string) (*File, error) {
157157
var r int
158158
for {
159159
var e error
160-
r, e = unix.Openat(dirfd, name, O_RDONLY, 0)
160+
r, e = unix.Openat(dirfd, name, O_RDONLY|syscall.O_CLOEXEC, 0)
161161
if e == nil {
162162
break
163163
}

0 commit comments

Comments
 (0)