mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-06 04:38:07 +02:00
2004-03-27 Havoc Pennington <hp@redhat.com>
Patch from Timo Teräs: * tools/dbus-send.c (main): if --print-reply, assume type is method call; support boolean type args * dbus/dbus-connection.c (dbus_connection_send_with_reply): fix a bunch of memleak and logic bugs
This commit is contained in:
parent
45277e93d8
commit
a221eefadf
3 changed files with 43 additions and 22 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
||||||
|
2004-03-27 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
Patch from Timo Teräs:
|
||||||
|
|
||||||
|
* tools/dbus-send.c (main): if --print-reply, assume type is
|
||||||
|
method call; support boolean type args
|
||||||
|
|
||||||
|
* dbus/dbus-connection.c (dbus_connection_send_with_reply): fix a
|
||||||
|
bunch of memleak and logic bugs
|
||||||
|
|
||||||
2004-03-23 Owen Fraser-Green <owen@discobabe.net>
|
2004-03-23 Owen Fraser-Green <owen@discobabe.net>
|
||||||
|
|
||||||
* mono/Arguments.cs:
|
* mono/Arguments.cs:
|
||||||
|
|
|
||||||
|
|
@ -1749,20 +1749,15 @@ dbus_connection_send_with_reply (DBusConnection *connection,
|
||||||
|
|
||||||
reply = dbus_message_new_error (message, DBUS_ERROR_NO_REPLY,
|
reply = dbus_message_new_error (message, DBUS_ERROR_NO_REPLY,
|
||||||
"No reply within specified time");
|
"No reply within specified time");
|
||||||
if (!reply)
|
if (reply == NULL)
|
||||||
{
|
goto error;
|
||||||
CONNECTION_UNLOCK (connection);
|
|
||||||
dbus_pending_call_unref (pending);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
reply_link = _dbus_list_alloc_link (reply);
|
reply_link = _dbus_list_alloc_link (reply);
|
||||||
if (!reply)
|
if (reply_link == NULL)
|
||||||
{
|
{
|
||||||
CONNECTION_UNLOCK (connection);
|
CONNECTION_UNLOCK (connection);
|
||||||
dbus_message_unref (reply);
|
dbus_message_unref (reply);
|
||||||
dbus_pending_call_unref (pending);
|
goto error_unlocked;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pending->timeout_link = reply_link;
|
pending->timeout_link = reply_link;
|
||||||
|
|
@ -1772,29 +1767,30 @@ dbus_connection_send_with_reply (DBusConnection *connection,
|
||||||
* Also, add the timeout.
|
* Also, add the timeout.
|
||||||
*/
|
*/
|
||||||
if (!_dbus_connection_attach_pending_call_unlocked (connection,
|
if (!_dbus_connection_attach_pending_call_unlocked (connection,
|
||||||
pending))
|
pending))
|
||||||
{
|
goto error;
|
||||||
CONNECTION_UNLOCK (connection);
|
|
||||||
dbus_pending_call_unref (pending);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_dbus_connection_send_unlocked (connection, message, NULL))
|
if (!_dbus_connection_send_unlocked (connection, message, NULL))
|
||||||
{
|
{
|
||||||
_dbus_connection_detach_pending_call_and_unlock (connection,
|
_dbus_connection_detach_pending_call_and_unlock (connection,
|
||||||
pending);
|
pending);
|
||||||
return FALSE;
|
goto error_unlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pending_return)
|
if (pending_return)
|
||||||
{
|
*pending_return = pending;
|
||||||
dbus_pending_call_ref (pending);
|
else
|
||||||
*pending_return = pending;
|
dbus_pending_call_unref (pending);
|
||||||
}
|
|
||||||
|
|
||||||
CONNECTION_UNLOCK (connection);
|
CONNECTION_UNLOCK (connection);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
error:
|
||||||
|
CONNECTION_UNLOCK (connection);
|
||||||
|
error_unlocked:
|
||||||
|
dbus_pending_call_unref (pending);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DBusMessage*
|
static DBusMessage*
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,10 @@ main (int argc, char *argv[])
|
||||||
else if (strcmp (arg, "--session") == 0)
|
else if (strcmp (arg, "--session") == 0)
|
||||||
type = DBUS_BUS_SESSION;
|
type = DBUS_BUS_SESSION;
|
||||||
else if (strcmp (arg, "--print-reply") == 0)
|
else if (strcmp (arg, "--print-reply") == 0)
|
||||||
print_reply = TRUE;
|
{
|
||||||
|
print_reply = TRUE;
|
||||||
|
message_type = DBUS_MESSAGE_TYPE_METHOD_CALL;
|
||||||
|
}
|
||||||
else if (strstr (arg, "--dest=") == arg)
|
else if (strstr (arg, "--dest=") == arg)
|
||||||
dest = strchr (arg, '=') + 1;
|
dest = strchr (arg, '=') + 1;
|
||||||
else if (strstr (arg, "--type=") == arg)
|
else if (strstr (arg, "--type=") == arg)
|
||||||
|
|
@ -227,6 +230,18 @@ main (int argc, char *argv[])
|
||||||
dbus_message_iter_append_string (&iter, c);
|
dbus_message_iter_append_string (&iter, c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DBUS_TYPE_BOOLEAN:
|
||||||
|
if (strcmp(c, "true") == 0)
|
||||||
|
dbus_message_iter_append_boolean (&iter, TRUE);
|
||||||
|
else if (strcmp(c, "false") == 0)
|
||||||
|
dbus_message_iter_append_boolean (&iter, FALSE);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Expected \"true\" or \"false\" instead of \"%s\"\n", argv[0], c);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "%s: Unsupported data type\n", argv[0]);
|
fprintf (stderr, "%s: Unsupported data type\n", argv[0]);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue