Unverified Commit 1a938046 authored by sundb's avatar sundb Committed by GitHub
Browse files

Return 0 when config set out-of-range oom-score-adj-values (#10601)

When oom-score-adj-values is out of range, setConfigOOMScoreAdjValuesOption
should return 0, not -1, otherwise it will be considered as success.
parent 85899e35
...@@ -2641,7 +2641,7 @@ static int setConfigOOMScoreAdjValuesOption(standardConfig *config, sds *argv, i ...@@ -2641,7 +2641,7 @@ static int setConfigOOMScoreAdjValuesOption(standardConfig *config, sds *argv, i
if (*eptr != '\0' || val < -2000 || val > 2000) { if (*eptr != '\0' || val < -2000 || val > 2000) {
if (err) *err = "Invalid oom-score-adj-values, elements must be between -2000 and 2000."; if (err) *err = "Invalid oom-score-adj-values, elements must be between -2000 and 2000.";
return -1; return 0;
} }
values[i] = val; values[i] = val;
......
...@@ -122,5 +122,10 @@ if {$system_name eq {linux}} { ...@@ -122,5 +122,10 @@ if {$system_name eq {linux}} {
r config set oom-score-adj absolute r config set oom-score-adj absolute
assert_equal [get_oom_score_adj] $custom_oom assert_equal [get_oom_score_adj] $custom_oom
} }
test {CONFIG SET out-of-range oom score} {
assert_error {ERR *must be between -2000 and 2000*} {r config set oom-score-adj-values "-2001 -2001 -2001"}
assert_error {ERR *must be between -2000 and 2000*} {r config set oom-score-adj-values "2001 2001 2001"}
}
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment