[systemd-devel] [PATCH] core: fix oneshot service resource control

Umut Tezduyar Lindskog umut at tezduyar.com
Tue Jul 15 06:14:02 PDT 2014


On Tue, Jul 15, 2014 at 3:03 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Tue, Jul 15, 2014 at 08:36:29AM +0200, Umut Tezduyar Lindskog wrote:
>> Oneshot services's cgroup is removed when the service
>> exits. An assert is hit otherwise.
>> ---
>>  src/core/manager.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/core/manager.c b/src/core/manager.c
>> index 3dffbe2..d27a45f 100644
>> --- a/src/core/manager.c
>> +++ b/src/core/manager.c
>> @@ -2542,7 +2542,8 @@ void manager_check_finished(Manager *m) {
>>          }
>>
>>          SET_FOREACH(u, m->startup_units, i)
>> -                cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
>> +                if (u && u->cgroup_path)
>> +                        cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
>
> Why do you have to check for u? When iterating over a set, u cannot be NULL, no?

It seems like SET_FOREACH does the null check already. Thanks Zbyszek.

>
> Zbyszek
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list