From 2631cad85db59ec19cce5ce0df2e7434ba214cee Mon Sep 17 00:00:00 2001 From: Spiky Caterpillar Date: Wed, 16 Nov 2022 23:18:44 +0000 Subject: [PATCH] No longer leak FDs on VT switch. Modified-by: Povilas Kanapickas Part-of: --- hw/xfree86/os-support/linux/systemd-logind.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c index efe710b3c..97f8902e9 100644 --- a/hw/xfree86/os-support/linux/systemd-logind.c +++ b/hw/xfree86/os-support/linux/systemd-logind.c @@ -398,6 +398,11 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) dbus_error_free(&error); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } + + /* + * fd will be received via DBus if and only if pause == 0, so it + * only needs to be closed in that code path + */ } else return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -432,6 +437,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) info->active = TRUE; if (pdev) { + close(fd); pdev->flags &= ~XF86_PDEV_PAUSED; } else systemd_logind_set_input_fd_for_all_devs(major, minor, fd,