chiark / gitweb /
logger: fix return value
[elogind.git] / socket.c
index aec0d392a683e531f674514b8a904e55d2b524e2..2a19e97b7bc7957af8fb9e5df798c08f840a9eca 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -129,6 +129,10 @@ static int socket_init(Unit *u) {
         if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(s->service))) < 0)
                 goto fail;
 
+        /* Add default cgroup */
+        if ((r = unit_add_default_cgroup(u)) < 0)
+                goto fail;
+
         return 0;
 
 fail:
@@ -263,7 +267,9 @@ static int socket_open_fds(Socket *s) {
                         struct stat st;
                         assert(p->type == SOCKET_FIFO);
 
-                        if (mkfifo(p->path, 0666 & ~s->exec_context.umask) < 0 && errno != EEXIST) {
+                        mkdir_parents(p->path, s->directory_mode);
+
+                        if (mkfifo(p->path, s->socket_mode) < 0 && errno != EEXIST) {
                                 r = -errno;
                                 goto rollback;
                         }
@@ -394,7 +400,13 @@ static int socket_spawn(Socket *s, ExecCommand *c, bool timeout, pid_t *_pid) {
         } else
                 unit_unwatch_timer(UNIT(s), &s->timer_watch);
 
-        if ((r = exec_spawn(c, &s->exec_context, NULL, 0, true, true, &pid)) < 0)
+        if ((r = exec_spawn(c,
+                            &s->exec_context,
+                            NULL, 0,
+                            true,
+                            true,
+                            UNIT(s)->meta.cgroup_bondings,
+                            &pid)) < 0)
                 goto fail;
 
         if ((r = unit_watch_pid(UNIT(s), pid)) < 0)
@@ -691,7 +703,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
         log_debug("%s control process exited, code=%s status=%i", unit_id(u), sigchld_code_to_string(code), status);
 
         if (s->control_command->command_next &&
-            (success || (s->state == SOCKET_EXEC_STOP_PRE || s->state == SOCKET_EXEC_STOP_POST))) {
+            (success || (s->state == SOCKET_STOP_PRE || s->state == SOCKET_STOP_POST))) {
                 log_debug("%s running next command for the state %s", unit_id(u), state_string_table[s->state]);
                 socket_run_next(s, success);
         } else {