Hi,

On 16-04-15 17:28, Ray Strode wrote:
It's possible to receive a message reply in the message filter if a
previous message call timed out locally before the reply arrived.

The message_filter function only handles signals, at the moment, and
does not properly handle message replies.

This commit changes the message_filter function to filter out all
non-signal messages, including spurious message replies.

Downstream-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1209347
Signed-off-by: Ray Strode <[email protected]>

Thanks both patches look good and are:

Reviewed-by: Hans de Goede <[email protected]>

Keith, can you pick these 2 up directly please?

Regards,

Hans

p.s.

Ray, you may want to reduce the number of context lines a bit next time
you post patches.


---
  hw/xfree86/os-support/linux/systemd-logind.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c 
b/hw/xfree86/os-support/linux/systemd-logind.c
index 49758f4..57c87c0 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -286,60 +286,63 @@ systemd_logind_ack_pause(struct systemd_logind_info *info,
                                         DBUS_TYPE_INVALID)) {
          LogMessage(X_ERROR, "systemd-logind: out of memory\n");
          goto cleanup;
      }

      reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
                                                        DBUS_TIMEOUT, &error);
      if (!reply)
          LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
                     error.message);

  cleanup:
      if (msg)
          dbus_message_unref(msg);
      if (reply)
          dbus_message_unref(reply);
      dbus_error_free(&error);
  }

  static DBusHandlerResult
  message_filter(DBusConnection * connection, DBusMessage * message, void *data)
  {
      struct systemd_logind_info *info = data;
      struct xf86_platform_device *pdev = NULL;
      InputInfoPtr pInfo = NULL;
      int ack = 0, pause = 0, fd = -1;
      DBusError error;
      dbus_int32_t major, minor;
      char *pause_str;

+    if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
      dbus_error_init(&error);

      if (dbus_message_is_signal(message,
                                 "org.freedesktop.DBus", "NameOwnerChanged")) {
          char *name, *old_owner, *new_owner;

          dbus_message_get_args(message, &error,
                                DBUS_TYPE_STRING, &name,
                                DBUS_TYPE_STRING, &old_owner,
                                DBUS_TYPE_STRING, &new_owner, 
DBUS_TYPE_INVALID);
          if (dbus_error_is_set(&error)) {
              LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
                         error.message);
              dbus_error_free(&error);
              return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
          }

          if (name && strcmp(name, "org.freedesktop.login1") == 0)
              FatalError("systemd-logind disappeared (stopped/restarted?)\n");

          return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
      }

      if (strcmp(dbus_message_get_path(message), info->session) != 0)
          return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

      if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
                                 "PauseDevice")) {
          if (!dbus_message_get_args(message, &error,
                                 DBUS_TYPE_UINT32, &major,

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to