chiark / gitweb /
unit-printf: before resolving exec context specifiers check whether the object actual...
[elogind.git] / src / core / socket.c
index 19b463e6a452553c6cc922f79764ab796bd5202f..361404512c71701cafdc30f29d8d39c4cd642a13 100644 (file)
@@ -39,6 +39,7 @@
 #include "mkdir.h"
 #include "path-util.h"
 #include "unit-name.h"
+#include "unit-printf.h"
 #include "dbus-socket.h"
 #include "missing.h"
 #include "special.h"
@@ -374,7 +375,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;
         }
@@ -584,7 +585,7 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) {
         }
 
         case AF_INET6: {
-                static const char ipv4_prefix[] = {
+                static const unsigned char ipv4_prefix[] = {
                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF
                 };
 
@@ -1850,7 +1851,8 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
         if (w->socket_accept) {
                 for (;;) {
 
-                        if ((cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK)) < 0) {
+                        cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK);
+                        if (cfd < 0) {
 
                                 if (errno == EINTR)
                                         continue;
@@ -1884,7 +1886,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;
@@ -2194,6 +2196,8 @@ DEFINE_STRING_TABLE_LOOKUP(socket_result, SocketResult);
 
 const UnitVTable socket_vtable = {
         .object_size = sizeof(Socket),
+        .exec_context_offset = offsetof(Socket, exec_context),
+
         .sections =
                 "Unit\0"
                 "Socket\0"