Magellan Linux

Annotation of /trunk/xorg-server/patches/xorg-server-1.17.1-systemd-logind-filter-out-non-signal-messages-from.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2576 - (hide annotations) (download)
Mon Jun 15 13:02:17 2015 UTC (9 years, 3 months ago) by niro
File size: 3411 byte(s)
-fixed garbage patches
1 niro 2576 From e90798c142dedc4fd296936b69fe34a40d0aa35a Mon Sep 17 00:00:00 2001
2     From: Ray Strode <rstrode@redhat.com>
3 niro 2575 Date: Fri, 10 Apr 2015 14:19:50 -0400
4     Subject: [PATCH] systemd-logind: filter out non-signal messages from message
5     filter
6    
7     It's possible to receive a message reply in the message filter if a
8     previous message call timed out locally before the reply arrived.
9    
10     The message_filter function only handles signals, at the moment, and
11     does not properly handle message replies.
12    
13     This commit changes the message_filter function to filter out all
14     non-signal messages, including spurious message replies.
15    
16     https://bugzilla.redhat.com/show_bug.cgi?id=1209347
17 niro 2576 ---
18 niro 2575 hw/xfree86/os-support/linux/systemd-logind.c | 3 +++
19     1 file changed, 3 insertions(+)
20    
21     diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
22     index 49758f4..57c87c0 100644
23 niro 2576 --- a/hw/xfree86/os-support/linux/systemd-logind.c
24     +++ b/hw/xfree86/os-support/linux/systemd-logind.c
25     @@ -286,60 +286,63 @@ systemd_logind_ack_pause(struct systemd_logind_info *info,
26 niro 2575 DBUS_TYPE_INVALID)) {
27 niro 2576 LogMessage(X_ERROR, "systemd-logind: out of memory\n");
28 niro 2575 goto cleanup;
29     }
30    
31 niro 2576 reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
32     DBUS_TIMEOUT, &error);
33 niro 2575 if (!reply)
34 niro 2576 LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
35 niro 2575 error.message);
36    
37     cleanup:
38     if (msg)
39     dbus_message_unref(msg);
40     if (reply)
41     dbus_message_unref(reply);
42 niro 2576 dbus_error_free(&error);
43 niro 2575 }
44    
45     static DBusHandlerResult
46     message_filter(DBusConnection * connection, DBusMessage * message, void *data)
47     {
48     struct systemd_logind_info *info = data;
49     struct xf86_platform_device *pdev = NULL;
50     InputInfoPtr pInfo = NULL;
51     int ack = 0, pause = 0, fd = -1;
52     DBusError error;
53     dbus_int32_t major, minor;
54     char *pause_str;
55    
56 niro 2576 + if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
57     + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
58     +
59     dbus_error_init(&error);
60 niro 2575
61     if (dbus_message_is_signal(message,
62 niro 2576 "org.freedesktop.DBus", "NameOwnerChanged")) {
63 niro 2575 char *name, *old_owner, *new_owner;
64    
65 niro 2576 dbus_message_get_args(message, &error,
66     DBUS_TYPE_STRING, &name,
67     DBUS_TYPE_STRING, &old_owner,
68     DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
69     if (dbus_error_is_set(&error)) {
70     LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
71 niro 2575 error.message);
72 niro 2576 dbus_error_free(&error);
73 niro 2575 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
74     }
75    
76 niro 2576 if (name && strcmp(name, "org.freedesktop.login1") == 0)
77     FatalError("systemd-logind disappeared (stopped/restarted?)\n");
78 niro 2575
79     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
80     }
81    
82 niro 2576 if (strcmp(dbus_message_get_path(message), info->session) != 0)
83 niro 2575 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
84    
85 niro 2576 if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
86     "PauseDevice")) {
87     if (!dbus_message_get_args(message, &error,
88     DBUS_TYPE_UINT32, &major,
89     --
90     2.3.3