summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-08-24 21:08:17 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-08-24 21:08:17 +0000
commitba84f1e3781ef52666228d38ec6a0c27c5454d30 (patch)
tree4b11e7f427dbb30fa6c252bd36f15953613796c0 /hcid
parent87af78afc0d5753583825f061c36f7705762c576 (diff)
Fix D-Bus crashes
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c
index 7f98c32f..d9d74d7a 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -120,7 +120,9 @@ static void free_pin_req(void *req)
void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci)
{
DBusMessage *message;
-#ifndef HAVE_DBUS_MESSAGE_APPEND_ARGS
+#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
+ uint8_t *addr = (uint8_t *) &ci->bdaddr;
+#else
DBusMessageIter iter;
#endif
DBusPendingCall *pending = NULL;
@@ -140,7 +142,7 @@ void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci)
#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
dbus_message_append_args(message, DBUS_TYPE_BOOLEAN, &ci->out,
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
- &ci->bdaddr, sizeof(bdaddr_t), DBUS_TYPE_INVALID);
+ &addr, sizeof(bdaddr_t), DBUS_TYPE_INVALID);
#else
dbus_message_append_iter_init(message, &iter);
@@ -173,10 +175,12 @@ failed:
void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, int8_t rssi)
{
DBusMessage *message;
-#ifndef HAVE_DBUS_MESSAGE_APPEND_ARGS
+ char local_addr[18], peer_addr[18];
+#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
+ char *local_ptr = local_addr, *peer_ptr = peer_addr;
+#else
DBusMessageIter iter;
#endif
- char local_addr[18], peer_addr[18];
ba2str(local, local_addr);
ba2str(peer, peer_addr);
@@ -190,10 +194,10 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, i
#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
dbus_message_append_args(message,
- DBUS_TYPE_STRING, local_addr,
- DBUS_TYPE_STRING, peer_addr,
- DBUS_TYPE_UINT32, class,
- DBUS_TYPE_INT32, rssi,
+ DBUS_TYPE_STRING, &local_ptr,
+ DBUS_TYPE_STRING, &peer_ptr,
+ DBUS_TYPE_UINT32, &class,
+ DBUS_TYPE_INT32, &rssi,
DBUS_TYPE_INVALID);
#else
dbus_message_append_iter_init(message, &iter);
@@ -220,10 +224,13 @@ failed:
void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, char *name)
{
DBusMessage *message;
-#ifndef HAVE_DBUS_MESSAGE_APPEND_ARGS
+ char local_addr[18], peer_addr[18];
+#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
+ char *local_ptr = local_addr, *peer_ptr = peer_addr;
+ char *name_ptr = name;
+#else
DBusMessageIter iter;
#endif
- char local_addr[18], peer_addr[18];
ba2str(local, local_addr);
ba2str(peer, peer_addr);
@@ -237,9 +244,9 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, char *name)
#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
dbus_message_append_args(message,
- DBUS_TYPE_STRING, local_addr,
- DBUS_TYPE_STRING, peer_addr,
- DBUS_TYPE_STRING, name,
+ DBUS_TYPE_STRING, &local_ptr,
+ DBUS_TYPE_STRING, &peer_ptr,
+ DBUS_TYPE_STRING, &name_ptr,
DBUS_TYPE_INVALID);
#else
dbus_message_append_iter_init(message, &iter);