diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-21 21:55:12 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-21 21:55:12 +0000 | 
| commit | 3193afa28ace9972e36a418b22e83aa2ef9c08d1 (patch) | |
| tree | 9405c651384d21df4fd87d276adf2a2b03fbac79 | |
| parent | ccf289e82013b0eedd2fc35433e104aa53e042be (diff) | |
More accurate error reporting for GetConnectionUnixProcessID
| -rw-r--r-- | common/dbus.c | 19 | 
1 files changed, 13 insertions, 6 deletions
| diff --git a/common/dbus.c b/common/dbus.c index b6d852c3..7837aeba 100644 --- a/common/dbus.c +++ b/common/dbus.c @@ -319,6 +319,7 @@ dbus_bool_t dbus_bus_get_unix_process_id(DBusConnection *conn, const char *name,  						unsigned long *pid)  {  	DBusMessage *msg, *reply; +	DBusError err;  	dbus_uint32_t pid_arg;  	msg = dbus_message_new_method_call("org.freedesktop.DBus", @@ -337,16 +338,22 @@ dbus_bool_t dbus_bus_get_unix_process_id(DBusConnection *conn, const char *name,  		return FALSE;  	} -	reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL); -	if (!reply) { -		error("Sending GetConnectionUnixProcessID failed"); +	dbus_error_init(&err); +	reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err); +	if (dbus_error_is_set(&err)) { +		error("Sending GetConnectionUnixProcessID failed: %s", err.message); +		dbus_error_free(&err);  		dbus_message_unref(msg);  		return FALSE;  	} -	if (!dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32, &pid_arg, -					DBUS_TYPE_INVALID)) { -		error("Getting GetConnectionUnixProcessID args failed"); +	dbus_error_init(&err); +	dbus_message_get_args(reply, &err, DBUS_TYPE_UINT32, &pid_arg, +					DBUS_TYPE_INVALID); +	if (dbus_error_is_set(&err)) { +		error("Getting GetConnectionUnixProcessID args failed: %s", +				err.message); +		dbus_error_free(&err);  		dbus_message_unref(msg);  		dbus_message_unref(reply);  		return FALSE; | 
