Skip to content

Commit 6646b57

Browse files
committed
Check return value of Setrlimit() to keep linter happy
Signed-off-by: Chris Reeves <[email protected]>
1 parent 5241c92 commit 6646b57

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

run_linux.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,16 @@ func addRlimits(ulimit []string, g *generate.Generator, defaultUlimits []string)
10071007
// process to RLimitDefaultValue - this will be successful in most (but not all)
10081008
// non-rootless environments. If this fails (e.g. in a rootless environment) it will ensure
10091009
// that the soft limit for the current process is increased to match the hard limit (see
1010-
// cmd/podman/early_init_linux.go). We simply fire and forget the call to Setrlimit() here,
1011-
// because if it fails we effectively handle setting soft to hard in the call to
1012-
// AddProcessRlimits() later on.
1010+
// cmd/podman/early_init_linux.go).
10131011
var rlimit unix.Rlimit
10141012
rlimit.Cur = define.RLimitDefaultValue
10151013
rlimit.Max = define.RLimitDefaultValue
1016-
unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
1014+
err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
1015+
if err != nil {
1016+
// We don't really care whether there's an error here, because if it fails we
1017+
// effectively handle setting soft to hard in the call to AddProcessRlimits() later on.
1018+
logrus.Debugf("Failed to set RLIMIT_NOFILE ulimit %q", err)
1019+
}
10171020

10181021
// Set both hard and soft limits to min(hard limit, RLimitDefaultValue) regardless of
10191022
// rootlessness.

0 commit comments

Comments
 (0)