chiark / gitweb /
service: prohibit Restart= set when Type=oneshot
authorMaciej Wereski <m.wereski@partner.samsung.com>
Fri, 9 Aug 2013 10:54:10 +0000 (12:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 9 Aug 2013 16:09:21 +0000 (18:09 +0200)
TODO
src/core/service.c

diff --git a/TODO b/TODO
index ead699cd165e7eba0d42d67c3f059065808e52a6..60622f7c72561b5c7e7e3cf2a407f5824cac7b1a 100644 (file)
--- 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
index df49ce18539929db861df1991b0499900ac3ef54..4070fd741bf0f8dfa926fc0b4de5571b7aae02c2 100644 (file)
@@ -1113,6 +1113,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);