]> git.ipfire.org Git - people/ms/systemd.git/commitdiff
service: never do automatic restarts for user requested stops
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Apr 2010 20:55:14 +0000 (22:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Apr 2010 20:55:14 +0000 (22:55 +0200)
service.c
service.h

index eb8688671b0d4c132921f748cabd2d7a75b09873..84077a19f1ced83a8097f08544a126647fe95448 100644 (file)
--- a/service.c
+++ b/service.c
@@ -1318,6 +1318,7 @@ static void service_enter_dead(Service *s, bool success, bool allow_restart) {
                 s->failure = true;
 
         if (allow_restart &&
                 s->failure = true;
 
         if (allow_restart &&
+            s->allow_restart &&
             (s->restart == SERVICE_RESTART_ALWAYS ||
              (s->restart == SERVICE_RESTART_ON_SUCCESS && !s->failure))) {
 
             (s->restart == SERVICE_RESTART_ALWAYS ||
              (s->restart == SERVICE_RESTART_ON_SUCCESS && !s->failure))) {
 
@@ -1721,6 +1722,7 @@ static int service_start(Unit *u) {
 
         s->failure = false;
         s->main_pid_known = false;
 
         s->failure = false;
         s->main_pid_known = false;
+        s->allow_restart = true;
 
         service_enter_start_pre(s);
         return 0;
 
         service_enter_start_pre(s);
         return 0;
@@ -1754,6 +1756,10 @@ static int service_stop(Unit *u) {
 
         assert(s->state == SERVICE_RUNNING || s->state == SERVICE_EXITED);
 
 
         assert(s->state == SERVICE_RUNNING || s->state == SERVICE_EXITED);
 
+        /* This is a user request, so don't do restarts on this
+         * shutdown. */
+        s->allow_restart = false;
+
         service_enter_stop(s, true);
         return 0;
 }
         service_enter_stop(s, true);
         return 0;
 }
index 6700229b5c05a238a908f90ae54eccd77e2ed5af..40bd57e256a4a4ef0295a5c610fb276d4725a9a3 100644 (file)
--- a/service.h
+++ b/service.h
@@ -110,6 +110,8 @@ struct Service {
 
         bool bus_name_good:1;
 
 
         bool bus_name_good:1;
 
+        bool allow_restart:1;
+
         bool got_socket_fd:1;
 
         bool sysv_has_lsb:1;
         bool got_socket_fd:1;
 
         bool sysv_has_lsb:1;