summaryrefslogtreecommitdiffstats
path: root/common/error.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-06-06 10:01:33 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-06-06 10:01:33 +0000
commit52f1452d5dedfade299fa81b68fa759b13aa86d9 (patch)
treeec51d4992eab3fced5c6f1ead43b6efd128a11bf /common/error.c
parente64373ef34f318aa60030cde093aa7cd7694c714 (diff)
Fix the D-Bus sending for error messages
Diffstat (limited to 'common/error.c')
-rw-r--r--common/error.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/common/error.c b/common/error.c
index 51f4f4bc..096b8651 100644
--- a/common/error.c
+++ b/common/error.c
@@ -246,7 +246,11 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
if (!derr)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- return dbus_connection_send_and_unref(conn, derr);
+ dbus_connection_send(conn, derr, NULL);
+
+ dbus_message_unref(derr);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
}
/**
@@ -256,6 +260,7 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
*/
DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg)
{
+ DBusMessage *derr;
char error[128];
const char *signature = dbus_message_get_signature(msg);
const char *method = dbus_message_get_member(msg);
@@ -264,7 +269,14 @@ DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg)
snprintf(error, 128, "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist",
method, signature, interface);
- return send_message_and_unref(conn,
- dbus_message_new_error(msg, ERROR_INTERFACE ".UnknownMethod",
- error));
+ derr = dbus_message_new_error(msg, ERROR_INTERFACE ".UnknownMethod",
+ error);
+ if (!derr)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_connection_send(conn, derr, NULL);
+
+ dbus_message_unref(derr);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
}