summaryrefslogtreecommitdiffstats
path: root/tools/hcitool.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-16 22:58:53 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-16 22:58:53 +0000
commit12513fafd320f210190ab574383efe9591ce6c6e (patch)
treea8a449b34771cf402200c8189874dad6432c4a5f /tools/hcitool.c
parent91ec71874613cf65ab0abdaaf62c0b4e6a56a40e (diff)
Fix the case if device isn't found in the name cache
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r--tools/hcitool.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index a17fe8bc..5106f664 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -286,7 +286,7 @@ static int read_device_name(const bdaddr_t *local, const bdaddr_t *peer, char *n
char filename[PATH_MAX + 1], addr[18], str[249], *buf, *ptr;
bdaddr_t bdaddr;
struct stat st;
- int fd, pos, err = 0;
+ int fd, pos, err = -ENOENT;
ba2str(local, addr);
snprintf(filename, PATH_MAX, "%s/%s/names", DEVPATH, addr);
@@ -321,6 +321,7 @@ static int read_device_name(const bdaddr_t *local, const bdaddr_t *peer, char *n
if (!bacmp(&bdaddr, peer)) {
snprintf(name, 249, "%s", str);
+ err = 0;
break;
}
@@ -534,7 +535,7 @@ static void cmd_scan(int dev_id, int argc, char **argv)
for (i = 0; i < num_rsp; i++) {
memset(name, 0, sizeof(name));
- nc = read_device_name(&di.bdaddr, &(info+i)->bdaddr, name) < 0 ? 0 : 1;
+ nc = (read_device_name(&di.bdaddr, &(info+i)->bdaddr, name) == 0);
if (!extcls && !extinf && !extoui) {
ba2str(&(info+i)->bdaddr, addr);