X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fsocket.c;h=88599ca9c164a25ad33c049f802a571a9c7224a7;hb=d14ab08b29d5b0b3ead6e63ac8be472f273011f9;hp=aaaa8d6499b94da2f8e864fcaeb936dc8a107ec5;hpb=e821075a23fdfa3ca7738fc30bb2d4c430fe10c0;p=elogind.git diff --git a/src/core/socket.c b/src/core/socket.c index aaaa8d649..88599ca9c 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -671,10 +671,11 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { case AF_UNIX: { struct ucred ucred; + int k; - l = sizeof(ucred); - if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &l) < 0) - return -errno; + k = getpeercred(fd, &ucred); + if (k < 0) + return k; if (asprintf(&r, "%u-%lu-%lu", @@ -1254,6 +1255,7 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { UNIT(s)->manager->cgroup_supported, UNIT(s)->cgroup_path, UNIT(s)->id, + 0, NULL, s->exec_runtime, &pid); @@ -1475,6 +1477,13 @@ static void socket_enter_running(Socket *s, int cfd) { /* Flush all sockets by closing and reopening them */ socket_close_fds(s); + r = socket_open_fds(s); + if (r < 0) { + log_warning_unit(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r)); + socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); + return; + } + r = socket_watch_fds(s); if (r < 0) { log_warning_unit(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r)); @@ -2417,7 +2426,6 @@ const UnitVTable socket_vtable = { .bus_interface = "org.freedesktop.systemd1.Socket", .bus_vtable = bus_socket_vtable, - .bus_changing_properties = bus_socket_changing_properties, .bus_set_property = bus_socket_set_property, .bus_commit_properties = bus_socket_commit_properties,