chiark / gitweb /
socket: fix bitfields in fd watches
[elogind.git] / socket.c
index 827d7b5e97600f5771a5b7d828782e8da650702d..cb065b75bfeca5af7f7d31b2b34e6d403f9846f1 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -119,9 +119,14 @@ static bool have_non_accept_socket(Socket *s) {
         if (!s->accept)
                 return true;
 
-        LIST_FOREACH(port, p, s->ports)
+        LIST_FOREACH(port, p, s->ports) {
+
+                if (p->type != SOCKET_SOCKET)
+                        return true;
+
                 if (!socket_address_can_accept(&p->address))
                         return true;
+        }
 
         return false;
 }
@@ -448,8 +453,9 @@ static int socket_watch_fds(Socket *s) {
                 if (p->fd < 0)
                         continue;
 
-                p->fd_watch.data.socket_accept =
+                p->fd_watch.socket_accept =
                         s->accept &&
+                        p->type == SOCKET_SOCKET &&
                         socket_address_can_accept(&p->address);
 
                 if ((r = unit_watch_fd(UNIT(s), p->fd, EPOLLIN, &p->fd_watch)) < 0)
@@ -1088,7 +1094,7 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
                 goto fail;
         }
 
-        if (w->data.socket_accept) {
+        if (w->socket_accept) {
                 for (;;) {
 
                         if ((cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK)) < 0) {