chiark / gitweb /
socket: properly handle if our service vanished during runtime
authorLennart Poettering <lennart@poettering.net>
Thu, 22 May 2014 07:56:21 +0000 (16:56 +0900)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 May 2014 07:56:21 +0000 (16:56 +0900)
src/core/socket.c

index 05af8fe..aca20fd 100644 (file)
@@ -1503,6 +1503,12 @@ static void socket_enter_running(Socket *s, int cfd) {
                         }
 
                 if (!pending) {
+                        if (!UNIT_ISSET(s->service)) {
+                                log_error_unit(UNIT(s)->id, "%s: service to activate vanished, refusing activation.", UNIT(s)->id);
+                                r = -ENOENT;
+                                goto fail;
+                        }
+
                         r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_REPLACE, true, &error, NULL);
                         if (r < 0)
                                 goto fail;