chiark / gitweb /
automount: use unit_pending_inactive() where appropriate
[elogind.git] / src / socket.c
index 7dc205abde362a1d256a0e0a930e3881a9373ca0..e386c7f2971c7cbe9cd0c4749bc9ee80a05c506b 100644 (file)
@@ -41,6 +41,7 @@
 #include "special.h"
 #include "bus-errors.h"
 #include "label.h"
+#include "exit-status.h"
 
 static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = {
         [SOCKET_DEAD] = UNIT_INACTIVE,
@@ -759,8 +760,9 @@ static int socket_open_fds(Socket *s) {
                                 if ((r = socket_instantiate_service(s)) < 0)
                                         return r;
 
-                                if ((r = label_get_socket_label_from_exe(s->service->exec_command[SERVICE_EXEC_START]->path, &label)) < 0)
-                                        return r;
+                                if (s->service && s->service->exec_command[SERVICE_EXEC_START])
+                                        if ((r = label_get_socket_label_from_exe(s->service->exec_command[SERVICE_EXEC_START]->path, &label)) < 0)
+                                                return r;
 
                                 know_label = true;
                         }
@@ -1187,6 +1189,8 @@ static void socket_enter_running(Socket *s, int cfd) {
         /* We don't take connections anymore if we are supposed to
          * shut down anyway */
         if (unit_pending_inactive(UNIT(s))) {
+                log_debug("Suppressing connection request on %s since unit stop is scheduled.", s->meta.id);
+
                 if (cfd >= 0)
                         close_nointr_nofail(cfd);
                 else  {