chiark / gitweb /
core: move ManagerRunningAs to shared
[elogind.git] / src / core / socket.c
index f975a4333d542dfa96720906a41f922a0792fb98..26e7fd24de7c7ebcf0770d0390a8c3221d5b9822 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"
@@ -305,7 +306,7 @@ static int socket_add_default_dependencies(Socket *s) {
         int r;
         assert(s);
 
-        if (UNIT(s)->manager->running_as == MANAGER_SYSTEM) {
+        if (UNIT(s)->manager->running_as == SYSTEMD_SYSTEM) {
                 if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, SPECIAL_SOCKETS_TARGET, NULL, true)) < 0)
                         return r;
 
@@ -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;
@@ -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"