chiark / gitweb /
service: add options RestartPreventExitStatus and SuccessExitStatus
[elogind.git] / src / core / socket.c
index 6d417878b5e1b5c48d9b29efa4b313d5779aff9b..cbbfb0cd3a033436a7215ec36fa72300a78ffa01 100644 (file)
@@ -374,7 +374,7 @@ static int socket_load(Unit *u) {
                         if ((r = socket_add_default_dependencies(s)) < 0)
                                 return r;
 
-                r = unit_patch_working_directory(UNIT(s), &s->exec_context);
+                r = unit_exec_context_defaults(u, &s->exec_context);
                 if (r < 0)
                         return r;
         }
@@ -1884,7 +1884,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
 
         s->control_pid = 0;
 
-        if (is_clean_exit(code, status))
+        if (is_clean_exit(code, status, NULL))
                 f = SOCKET_SUCCESS;
         else if (code == CLD_EXITED)
                 f = SOCKET_FAILURE_EXIT_CODE;
@@ -2104,7 +2104,7 @@ static void socket_reset_failed(Unit *u) {
         s->result = SOCKET_SUCCESS;
 }
 
-static int socket_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
+static int socket_kill(Unit *u, KillWho who, int signo, DBusError *error) {
         Socket *s = SOCKET(u);
         int r = 0;
         Set *pid_set = NULL;
@@ -2126,23 +2126,25 @@ static int socket_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
                         if (kill(s->control_pid, signo) < 0)
                                 r = -errno;
 
-        if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) {
+        if (who == KILL_ALL) {
                 int q;
 
-                if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
+                pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                if (!pid_set)
                         return -ENOMEM;
 
                 /* Exclude the control pid from being killed via the cgroup */
-                if (s->control_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(s->control_pid))) < 0) {
+                if (s->control_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(s->control_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
 
                 q = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, signo, false, false, pid_set, NULL);
-                if (q < 0)
-                        if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
-                                r = q;
+                if (q < 0 && q != -EAGAIN && q != -ESRCH && q != -ENOENT)
+                        r = q;
         }
 
 finish: