X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=34dde7963e6fdd6d53b375ce37e1953f8004be82;hb=06eb4e3bf87584ea526a90643d49037cf6ffd7ff;hp=df49ce18539929db861df1991b0499900ac3ef54;hpb=41efeaec037678ac790e2a02df9020f83cc3a359;p=elogind.git diff --git a/src/core/service.c b/src/core/service.c index df49ce185..34dde7963 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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); @@ -1951,6 +1957,12 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) /* we want fresh tmpdirs in case service is started again immediately */ exec_context_tmp_dirs_done(&s->exec_context); + /* Try to delete the pid file. At this point it will be + * out-of-date, and some software might be confused by it, so + * let's remove it. */ + if (s->pid_file) + unlink_noerrno(s->pid_file); + return; fail: