Skip to content

Commit 421f08f

Browse files
author
zhouhao
committed
validate: add rlimits's type judgment
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
1 parent a652af1 commit 421f08f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

validate/validate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ func (v *Validator) CheckProcess() (msgs []string) {
257257
if process.Rlimits[index].Hard < process.Rlimits[index].Soft {
258258
msgs = append(msgs, fmt.Sprintf("hard limit of rlimit %s should not be less than soft limit.", process.Rlimits[index].Type))
259259
}
260+
for i := index + 1; i < len(process.Rlimits); i++ {
261+
if strings.EqualFold(process.Rlimits[index].Type, process.Rlimits[i].Type) {
262+
msgs = append(msgs, fmt.Sprintf("rlimit can not contain the same type %q.", process.Rlimits[index].Type))
263+
}
264+
}
260265
}
261266

262267
if len(process.ApparmorProfile) > 0 {

0 commit comments

Comments
 (0)