From: Zbigniew Jędrzejewski-Szmek Date: Wed, 18 Apr 2018 18:06:56 +0000 (+0200) Subject: core: do not allow Delegate= on unsupported unit types X-Git-Tag: v239~388^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecae73d74ab55c001c7c460a93c8e3710dee55f3;p=platform%2Fupstream%2Fsystemd.git core: do not allow Delegate= on unsupported unit types --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 403c0af..61e752a 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3404,8 +3404,17 @@ 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. */