Don't fail on setting -ve oom score when rootless
This allows non-privileged users to use containerd. If a non root user tried to set a negative oom score adjustment, it will fail. Containerd should not fail if running rootless. This is part of a larger track of work integrating containerd into Cloudfoundry's garden with support for rootless. [#156343443] Signed-off-by: Danail Branekov <danailster@gmail.com>
This commit is contained in:

committed by
Danail Branekov

parent
40c3acd36c
commit
544b985ff2
@@ -38,7 +38,7 @@ func SetOOMScore(pid, score int) error {
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err = f.WriteString(strconv.Itoa(score)); err != nil {
|
||||
if os.IsPermission(err) && system.RunningInUserNS() {
|
||||
if os.IsPermission(err) && (system.RunningInUserNS() || RunningUnprivileged()) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
Reference in New Issue
Block a user