summaryrefslogtreecommitdiffstats
path: root/hcid/main.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-26 12:36:19 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-07-26 12:36:19 +0000
commit312e3ea913578a40d78635d5702bedd655501445 (patch)
tree25d0795d8a0a00c248a34bc0cfe793b6da83f77f /hcid/main.c
parentab13e6cdba9c3f58f6772560ab86f5ce4578d5ff (diff)
Fix the other missing storage functions
Diffstat (limited to 'hcid/main.c')
-rw-r--r--hcid/main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hcid/main.c b/hcid/main.c
index 4dcf2510..78c42208 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -151,9 +151,9 @@ static struct device_opts *get_device_opts(int sock, int hdev)
int get_discoverable_timeout(int hdev)
{
int sock, timeout;
- char address[18];
struct device_opts *device_opts = NULL;
struct hci_dev_info di;
+ char addr[18];
if (hdev < 0)
return HCID_DEFAULT_DISCOVERABLE_TIMEOUT;
@@ -163,19 +163,18 @@ int get_discoverable_timeout(int hdev)
goto no_address;
di.dev_id = hdev;
- if (!ioctl(sock, HCIGETDEVINFO, (void *) &di))
- ba2str(&di.bdaddr, address);
- else {
+ if (ioctl(sock, HCIGETDEVINFO, (void *) &di) < 0) {
close(sock);
goto no_address;
}
close(sock);
- if (!read_discoverable_timeout(address, &timeout))
+ if (read_discoverable_timeout(&di.bdaddr, &timeout) == 0)
return timeout;
- device_opts = find_device_opts(address);
+ ba2str(&di.bdaddr, addr);
+ device_opts = find_device_opts(addr);
no_address:
if (!device_opts) {