summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-16 22:52:36 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-16 22:52:36 +0000
commit91ec71874613cf65ab0abdaaf62c0b4e6a56a40e (patch)
tree842ecc5e8a36a2f8f18b5bc5e522860554e5bdeb
parent304b8bb466c0b015d30f9dfbc785d2a7c0a2ef79 (diff)
Fix the name cache state
-rw-r--r--tools/hcitool.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 947da44e..a17fe8bc 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -544,7 +544,6 @@ static void cmd_scan(int dev_id, int argc, char **argv)
continue;
}
- memset(name, 0, sizeof(name));
if (hci_read_remote_name_with_clock_offset(dd,
&(info+i)->bdaddr,
(info+i)->pscan_rep_mode,
@@ -598,13 +597,15 @@ static void cmd_scan(int dev_id, int argc, char **argv)
}
if (handle > 0 || !nc) {
- memset(name, 0, sizeof(name));
if (hci_read_remote_name_with_clock_offset(dd,
&(info+i)->bdaddr,
(info+i)->pscan_rep_mode,
(info+i)->clock_offset | 0x8000,
- sizeof(name), name, 100000) < 0)
- strcpy(name, "n/a");
+ sizeof(name), name, 100000) < 0) {
+ if (!nc)
+ strcpy(name, "n/a");
+ } else
+ nc = 0;
}
printf("Device name:\t%s%s\n", name, nc ? " [cached]" : "");