[systemd-devel] [PATCH] service: prohibit Restart= set when Type=oneshot
Lennart Poettering
lennart at poettering.net
Fri Aug 9 09:15:15 PDT 2013
On Fri, 09.08.13 12:54, Maciej Wereski (m.wereski at partner.samsung.com) wrote:
Applied!
Thanks!
> ---
> TODO | 2 --
> src/core/service.c | 6 ++++++
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/TODO b/TODO
> index ead699c..60622f7 100644
> --- a/TODO
> +++ b/TODO
> @@ -88,8 +88,6 @@ Features:
> full, make sure to write how many messages are lost as first thing
> to syslog when it works again.
>
> -* prohibit Restart= set with Type=oneshot
> -
> * man: the documentation of Restart= currently is very misleading and suggests the tools from ExecStartPre= might get restarted.
>
> * load .d/*.conf dropins for device units
> diff --git a/src/core/service.c b/src/core/service.c
> index b98f11a..e77bd37 100644
> --- a/src/core/service.c
> +++ b/src/core/service.c
> @@ -1111,6 +1111,12 @@ static int service_verify(Service *s) {
> return -EINVAL;
> }
>
> + if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) {
> + log_error_unit(UNIT(s)->id,
> + "%s has Restart setting other than no, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
> + return -EINVAL;
> + }
> +
> if (s->type == SERVICE_DBUS && !s->bus_name) {
> log_error_unit(UNIT(s)->id,
> "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id);
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list