summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-22 17:40:12 +0200
committerGitHub <noreply@github.com>2016-07-22 17:40:12 +0200
commit5052c4eadd31715ed21e091dec0dce5f4f3d7baa (patch)
tree5f03c55daf026b4ceac99ae71de3d9645224d17b /src/core/load-fragment.c
parentfec603eb6cbba4ea03ef01e3ad48fa85a4812a9c (diff)
parentb3785cd5e6a0ac4d465713db221e1a150aabd5f6 (diff)
Merge pull request #3753 from poettering/tasks-max-scale
Add support for relative TasksMax= specifications, and bump default for services
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 782e420e4c..ae306de4ae 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2823,8 +2823,8 @@ int config_parse_memory_limit(
} else
bytes = physical_memory_scale(r, 100U);
- if (bytes < 1) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Memory limit '%s' too small. Ignoring.", rvalue);
+ if (bytes <= 0 || bytes >= UINT64_MAX) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Memory limit '%s' out of range. Ignoring.", rvalue);
return 0;
}
}
@@ -2861,9 +2861,18 @@ int config_parse_tasks_max(
return 0;
}
- r = safe_atou64(rvalue, &u);
- if (r < 0 || u < 1) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Maximum tasks value '%s' invalid. Ignoring.", rvalue);
+ r = parse_percent(rvalue);
+ if (r < 0) {
+ r = safe_atou64(rvalue, &u);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Maximum tasks value '%s' invalid. Ignoring.", rvalue);
+ return 0;
+ }
+ } else
+ u = system_tasks_max_scale(r, 100U);
+
+ if (u <= 0 || u >= UINT64_MAX) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Maximum tasks value '%s' out of range. Ignoring.", rvalue);
return 0;
}