summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-19 11:28:05 +0200
committerGitHub <noreply@github.com>2018-04-19 11:28:05 +0200
commit6360b8ff8383bb69978e6278298b4a2bef329f25 (patch)
treef72aa9a7a28dd55c37f3cadeb5d0d08a866e4362 /src
parentc5896b6a8cfcfd1b94f25450a96a1411384f1108 (diff)
parentecae73d74ab55c001c7c460a93c8e3710dee55f3 (diff)
downloadsystemd-6360b8ff8383bb69978e6278298b4a2bef329f25.tar.gz
Merge pull request #8758 from keszybz/improved-slice-checks
Improved slice checks
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 767355adf6..61e752ad3e 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -3404,14 +3404,23 @@ int config_parse_delegate(
void *userdata) {
CGroupContext *c = data;
+ UnitType t;
int r;
+ t = unit_name_to_type(unit);
+ assert(t != _UNIT_TYPE_INVALID);
+
+ if (!unit_vtable[t]->can_delegate) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Delegate= setting not supported for this unit type, ignoring.");
+ return 0;
+ }
+
/* We either accept a boolean value, which may be used to turn on delegation for all controllers, or turn it
* off for all. Or it takes a list of controller names, in which case we add the specified controllers to the
* mask to delegate. */
if (isempty(rvalue)) {
- c->delegate = true;
+ c->delegate = false;
c->delegate_controllers = 0;
return 0;
}
@@ -3432,7 +3441,7 @@ int config_parse_delegate(
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
- return r;
+ return 0;
}
cc = cgroup_controller_from_string(word);