diff options
author | Baokun Lee <nototon@gmail.com> | 2019-08-02 00:31:57 +0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2019-08-02 04:53:33 +0000 |
commit | 047a326569a5d75c2f5c1fd49fccb4da623b038a (patch) | |
tree | d010df417a97ccc51773a0a1f323f40162726a9e | |
parent | 3c977973949b167b91eff6db8f52570e7b13c81e (diff) | |
download | go-047a326569a5d75c2f5c1fd49fccb4da623b038a.tar.gz go-047a326569a5d75c2f5c1fd49fccb4da623b038a.zip |
[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 <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 2d6ee6e89a4b30c7528d2977df4e1aa86651e4e4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/188538
Run-TryBot: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/os/removeall_at.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go index 330963b354..c7de8a32a8 100644 --- a/src/os/removeall_at.go +++ b/src/os/removeall_at.go @@ -157,7 +157,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 } |