summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-06-22 01:36:06 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-06-22 01:36:06 +0000
commitb8020a613062f229b737174e934e75d96ba607d2 (patch)
tree65a1b45cde427d8e5a9e3e83044a696dc301a715 /daemon
parent1a2e7943da42619730e442d1ff6ab08b9c2c621d (diff)
Improve local connection handling
Diffstat (limited to 'daemon')
-rw-r--r--daemon/echo.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/daemon/echo.c b/daemon/echo.c
index 65d521a9..5813e1c0 100644
--- a/daemon/echo.c
+++ b/daemon/echo.c
@@ -239,6 +239,7 @@ static GIOChannel *setup_rfcomm(DBusConnection *conn, uint8_t channel)
static int setup_sdp(DBusConnection *conn, uint8_t channel)
{
DBusMessage *msg, *reply;
+ DBusError err;
sdp_record_t *record;
sdp_buf_t buf;
sdp_list_t *svclass, *pfseq, *apseq, *root, *aproto;
@@ -308,7 +309,9 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
dbus_message_append_args(msg, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
&buf.data, buf.data_size, DBUS_TYPE_INVALID);
- reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL);
+ dbus_error_init(&err);
+
+ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
dbus_message_unref(msg);
@@ -316,6 +319,8 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
if (!reply) {
error("Registration of service record failed");
+ error("%s", err.message);
+ dbus_error_free(&err);
return -1;
}
@@ -329,6 +334,7 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
static int register_standalone(DBusConnection *conn)
{
DBusMessage *msg, *reply;
+ DBusError err;
const char *ident = "echo", *name = "Echo service", *desc = "";
info("Registering service");
@@ -344,12 +350,16 @@ static int register_standalone(DBusConnection *conn)
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &desc, DBUS_TYPE_INVALID);
- reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL);
+ dbus_error_init(&err);
+
+ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
dbus_message_unref(msg);
if (!reply) {
error("Registration of service failed");
+ error("%s", err.message);
+ dbus_error_free(&err);
return -1;
}
@@ -389,6 +399,10 @@ int main(int argc, char *argv[])
enable_debug();
addr = getenv("BLUETOOTHD_ADDRESS");
+ if (!addr) {
+ error("No D-Bus server address available");
+ exit(1);
+ }
debug("Bluetooth daemon at %s", addr);