diff options
| author | Jes Cok <xigua67damn@gmail.com> | 2023-09-29 06:06:40 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-09-29 18:51:35 +0000 |
| commit | fa4f951026f697bc042422d95a0806dcbab7ddd0 (patch) | |
| tree | 865225530fef2c5c87c9a077c1b386d1363bd44d /src/syscall/exec_libc2.go | |
| parent | 9bfaaa15fd38f10ba7f11eb6cc67c6dfb21454e6 (diff) | |
| download | go-fa4f951026f697bc042422d95a0806dcbab7ddd0.tar.xz | |
syscall: make origRlimitNofile atomic.Pointer[Rlimit]
Currently we are bootstrapping with Go 1.20, origRlimitNofile can
be changed to atomic.Pointer[Rlimit].
Change-Id: I00ce9d1a9030bd5dbd34e3dc6c4e38683a87be86
GitHub-Last-Rev: f2ccdb38412019d10661ed6be42086b445e411bf
GitHub-Pull-Request: golang/go#63274
Reviewed-on: https://go-review.googlesource.com/c/go/+/531516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/syscall/exec_libc2.go')
| -rw-r--r-- | src/syscall/exec_libc2.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go index 4fca701d6b..7a67500844 100644 --- a/src/syscall/exec_libc2.go +++ b/src/syscall/exec_libc2.go @@ -65,7 +65,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr ngroups, groups uintptr ) - rlim, rlimOK := origRlimitNofile.Load().(Rlimit) + rlim := origRlimitNofile.Load() // guard against side effects of shuffling fds below. // Make sure that nextfd is beyond any currently open files so @@ -272,8 +272,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // Restore original rlimit. - if rlimOK && rlim.Cur != 0 { - rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(RLIMIT_NOFILE), uintptr(unsafe.Pointer(&rlim)), 0) + if rlim != nil { + rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(RLIMIT_NOFILE), uintptr(unsafe.Pointer(rlim)), 0) } // Time to exec. |
