Skip to content

Commit

Permalink
syscall: don't change local limit if prlimit used for another process
Browse files Browse the repository at this point in the history
Fixes: golang#67184

Signed-off-by: lifubang <lifubang@acmcoder.com>
  • Loading branch information
lifubang committed May 6, 2024
1 parent 20130cc commit 4ce20f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/syscall/syscall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ func Munmap(b []byte) (err error) {
// This is unexported but can be called from x/sys/unix.
func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
err = prlimit1(pid, resource, newlimit, old)
if err == nil && newlimit != nil && resource == RLIMIT_NOFILE {
if err == nil && newlimit != nil && resource == RLIMIT_NOFILE && (pid == 0 || pid == Getpid()) {
origRlimitNofile.Store(nil)
}
return err
Expand Down

0 comments on commit 4ce20f3

Please sign in to comment.