core: chown RuntimeDirectory= if DynamicUser= is set
When DynamicUser= is set, then RuntimeDirectory= should be always chowned, as the service unit may enable RuntimeDirectoryPreserve=, and the uid or gid may changed from the last run. This also makes easier to migrate the service to use DynamicUser=.
This commit is contained in:
parent
906cb2eb74
commit
fdff1da299
|
@ -2089,10 +2089,10 @@ static int setup_exec_directory(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r = mkdir_label(p, context->directories[type].mode);
|
r = mkdir_label(p, context->directories[type].mode);
|
||||||
if (r == -EEXIST)
|
if (r < 0 && r != -EEXIST)
|
||||||
continue;
|
|
||||||
if (r < 0)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
if (r == -EEXIST && !context->dynamic_user)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't change the owner of the configuration directory, as in the common case it is not written to by
|
/* Don't change the owner of the configuration directory, as in the common case it is not written to by
|
||||||
|
|
Loading…
Reference in a new issue