From 878f35e5fba360c643bcb42a00945c73b4a40f50 Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold@gmail.com>
Date: Mon, 19 May 2025 08:39:45 +0300
Subject: [PATCH] dbus-transport-socket: Handle _DBUS_POLLHUP case in socket_do_iteration

Index: dbus/dbus-transport-socket.c
--- dbus/dbus-transport-socket.c.orig
+++ dbus/dbus-transport-socket.c
@@ -1208,8 +1208,8 @@ socket_do_iteration (DBusTransport *transport,
             do_io_error (transport);
           else
             {
-              dbus_bool_t need_read = (poll_fd.revents & _DBUS_POLLIN) > 0;
-              dbus_bool_t need_write = (poll_fd.revents & _DBUS_POLLOUT) > 0;
+              dbus_bool_t need_read = (poll_fd.revents & (_DBUS_POLLIN | _DBUS_POLLHUP)) > 0;
+              dbus_bool_t need_write = (poll_fd.revents & (_DBUS_POLLOUT | _DBUS_POLLHUP)) > 0;
 	      dbus_bool_t authentication_completed;
 
               _dbus_verbose ("in iteration, need_read=%d need_write=%d\n",
