Skip to content

Commit 3a6f748

Browse files
Merge pull request #461 from q384566678/rlimits-solaris
validate: add the validation of rlimit.type when platform is solaris
2 parents 4de3a09 + b3fc8fe commit 3a6f748

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: validate/validate.go

+17
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ const specConfig = "config.json"
3131

3232
var (
3333
defaultRlimits = []string{
34+
"RLIMIT_AS",
35+
"RLIMIT_CORE",
36+
"RLIMIT_CPU",
37+
"RLIMIT_DATA",
38+
"RLIMIT_FSIZE",
39+
"RLIMIT_NOFILE",
40+
"RLIMIT_STACK",
41+
}
42+
43+
defaultLinuxRlimits = []string{
3444
"RLIMIT_AS",
3545
"RLIMIT_CORE",
3646
"RLIMIT_CPU",
@@ -869,6 +879,13 @@ func (v *Validator) rlimitValid(rlimit rspec.POSIXRlimit) (errs error) {
869879
}
870880

871881
if v.platform == "linux" {
882+
for _, val := range defaultLinuxRlimits {
883+
if val == rlimit.Type {
884+
return
885+
}
886+
}
887+
errs = multierror.Append(errs, fmt.Errorf("rlimit type %q is invalid", rlimit.Type))
888+
} else if v.platform == "solaris" {
872889
for _, val := range defaultRlimits {
873890
if val == rlimit.Type {
874891
return

0 commit comments

Comments
 (0)