From 5cab0d3f3f0afcc06bb63dcf9eb9540afb22d8de Mon Sep 17 00:00:00 2001 From: fesu Date: Mon, 26 Aug 2019 15:01:34 +0800 Subject: [PATCH] update the max if cur will be greater than max for setting the limit Signed-off-by: Su Fei --- cmd/containerd-stress/rlimit_unix.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/containerd-stress/rlimit_unix.go b/cmd/containerd-stress/rlimit_unix.go index 807a9a92f..492f60432 100644 --- a/cmd/containerd-stress/rlimit_unix.go +++ b/cmd/containerd-stress/rlimit_unix.go @@ -31,6 +31,9 @@ func setRlimit() error { } if limit.Cur < rlimit { limit.Cur = rlimit + if limit.Max < limit.Cur { + limit.Max = limit.Cur + } if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { return err }