]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test-autolaunch-win: Remove redundant check for ERROR message
authorSimon McVittie <smcv@collabora.com>
Tue, 11 Oct 2022 17:41:00 +0000 (18:41 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 11 Oct 2022 18:20:53 +0000 (18:20 +0000)
This seems to have been intended to give a more specific error message
if the method call failed, but it will not have been effective, because
dbus_connection_send_with_reply_and_block() ends with a check for ERROR
messages using dbus_set_error_from_message(). This means that if the
reply was an ERROR message, it will already have been converted into a
DBusError by the time call_method() regains control.

Signed-off-by: Simon McVittie <smcv@collabora.com>
test/name-test/test-autolaunch-win.c

index e5e0da7f3c8ca234e11a0be921df099a4a5e3458..30b8353bcde62f0eded07173bb9c4e1e77a3c75b 100644 (file)
@@ -34,21 +34,6 @@ static int add_wait_time = 0;
 
 #define oom() _dbus_test_fatal ("Out of memory")
 
-/**
- * helper function
- */
-#define _dbus_error_set_from_message_with_location(a, b) __dbus_error_set_from_message_with_location (__FILE__, __LINE__, __FUNCTION__, a, b)
-
-static void
-__dbus_error_set_from_message_with_location (const char *file, int line, const char *function, DBusError *error, DBusMessage *message)
-{
-  char *str = NULL;
-  dbus_message_get_args (message, NULL,
-                         DBUS_TYPE_STRING, &str,
-                         DBUS_TYPE_INVALID);
-  dbus_set_error (error, dbus_message_get_error_name (message), "[%s(%d):%s] %s", file, line, function, str ? str : "");
-}
-
 static dbus_bool_t
 call_method (DBusConnection *conn,
                DBusError *error,
@@ -75,12 +60,8 @@ call_method (DBusConnection *conn,
       goto out;
     }
 
-  if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
-    {
-      _dbus_error_set_from_message_with_location (error, reply);
-      result = FALSE;
-      goto out;
-    }
+  /* ..._send_with_reply_and_block converts ERROR messages into errors */
+  _dbus_assert (dbus_message_get_type (reply) != DBUS_MESSAGE_TYPE_ERROR);
   result = TRUE;
 
 out: