}
#endif
+/**
+ * In bluez library, the maximum name length of a device is 8
+ */
+#define BLUEZ_DEVNAME_SIZE 8
+
/**
* struct for storing the information of the hardware. There is only
* one of these.
return count;
}
+
/**
* Open the bluetooth interface for reading/writing
*
addr.btAddr = 0;
addr.port = BT_PORT_ANY;
- if (GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH), 0) != GNUNET_OK)
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_bind (dev->handle, (const SOCKADDR*)&addr, sizeof (SOCKADDR_BTH)))
{
fprintf (stderr, "Failed to bind the socket: ");
if (GetLastError() == WSAENETDOWN)
memset (&dev_info, 0, sizeof(struct hci_dev_info));
dev_info.dev_id = request.dev[i].dev_id;
- strncpy (dev_info.name, dev->iface, IFNAMSIZ);
+ strncpy (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE);
if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info))
{
return 1;
}
- if (strcmp (dev_info.name, dev->iface) == 0)
+ if (strncmp (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE) == 0)
{
dev_id = dev_info.dev_id; //the device was found