mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-02 07:17:59 +02:00
Use dbus_set_error_from_message() to check for an error
Do not rely on dbus_message_get_args() to turn an ERROR message into DBusError. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=96653 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
07af048dd2
commit
e0f26388f7
1 changed files with 13 additions and 9 deletions
|
|
@ -526,7 +526,18 @@ test_processid (Fixture *f,
|
|||
while (m == NULL)
|
||||
test_main_context_iterate (f->ctx, TRUE);
|
||||
|
||||
if (dbus_message_get_args (m, &error,
|
||||
if (dbus_set_error_from_message (&error, m))
|
||||
{
|
||||
g_assert_cmpstr (error.name, ==, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN);
|
||||
|
||||
#ifdef PID_SHOULD_WORK
|
||||
g_error ("Expected pid to be passed, but got %s: %s",
|
||||
error.name, error.message);
|
||||
#endif
|
||||
|
||||
dbus_error_free (&error);
|
||||
}
|
||||
else if (dbus_message_get_args (m, &error,
|
||||
DBUS_TYPE_UINT32, &pid,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
|
|
@ -545,14 +556,7 @@ test_processid (Fixture *f,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_assert_cmpstr (error.name, ==, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN);
|
||||
|
||||
#ifdef PID_SHOULD_WORK
|
||||
g_error ("Expected pid to be passed, but got %s: %s",
|
||||
error.name, error.message);
|
||||
#endif
|
||||
|
||||
dbus_error_free (&error);
|
||||
g_error ("Unexpected error: %s: %s", error.name, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue