Skip to content

Commit

Permalink
os: enable the close-on-exec flag for openFdAt
Browse files Browse the repository at this point in the history
There's a race here with fork/exec, enable the close-on-exec flag
for the new file descriptor.

Fixes #33405

Change-Id: If95bae97a52b7026a930bb3427e47bae3b0032ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/188537
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
oiooj authored and ianlancetaylor committed Aug 1, 2019
1 parent e7c51ca commit 2d6ee6e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/removeall_at.go
Expand Up @@ -173,7 +173,7 @@ func openFdAt(dirfd int, name string) (*File, error) {
var r int
for {
var e error
r, e = unix.Openat(dirfd, name, O_RDONLY, 0)
r, e = unix.Openat(dirfd, name, O_RDONLY|syscall.O_CLOEXEC, 0)
if e == nil {
break
}
Expand Down

0 comments on commit 2d6ee6e

Please sign in to comment.