From 9fbf00c7802719becd633ecbc45879d5d0ddb985 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 10 Mar 2010 15:27:59 -0500 Subject: Properly handle dbus send attempts on a closed connection dbus_connection_send_with_reply() will report success and return a NULL pending_reply when the connection is not open for communication. This patch creates a new wrapper around dbus_connection_send_with_reply() to properly detect this condition and report it as an error. --- src/providers/dp_auth_util.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/providers/dp_auth_util.c') diff --git a/src/providers/dp_auth_util.c b/src/providers/dp_auth_util.c index 52911769a..e78884aaa 100644 --- a/src/providers/dp_auth_util.c +++ b/src/providers/dp_auth_util.c @@ -336,13 +336,9 @@ done: int dp_common_send_id(struct sbus_connection *conn, uint16_t version, const char *name) { - DBusPendingCall *pending_reply; - DBusConnection *dbus_conn; DBusMessage *msg; dbus_bool_t ret; - dbus_conn = sbus_get_connection(conn); - /* create the message */ msg = dbus_message_new_method_call(NULL, DP_PATH, @@ -365,23 +361,6 @@ int dp_common_send_id(struct sbus_connection *conn, uint16_t version, return EIO; } - ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply, - 30000 /* TODO: set timeout */); - if (!ret || !pending_reply) { - /* - * Critical Failure - * We can't communicate on this connection - * We'll drop it using the default destructor. - */ - DEBUG(0, ("D-BUS send failed.\n")); - dbus_message_unref(msg); - return EIO; - } - - /* Set up the reply handler */ - dbus_pending_call_set_notify(pending_reply, id_callback, NULL, NULL); - dbus_message_unref(msg); - - return EOK; + return sbus_conn_send(conn, msg, 30000, id_callback, NULL, NULL); } -- cgit