From 02afd3d1373cc6c3029c4b6cdce51ac97223087a Mon Sep 17 00:00:00 2001 From: Markus Brueffer Date: Fri, 2 Jun 2006 00:29:01 +0000 Subject: [PATCH] - Only print a clarifying message about which HCI node has been used if there is more than one HCI node present - Use errx(3) instead of err(3) if there is no HCI node present as errno is 0 in this case and the resulting error message wouldn't make much sense Approved by: emax (mentor) --- usr.sbin/bluetooth/hccontrol/hccontrol.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.c b/usr.sbin/bluetooth/hccontrol/hccontrol.c index c77200efd1d..089869b3cf0 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.c +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.c @@ -99,16 +99,18 @@ socket_open(char const *node) { struct sockaddr_hci addr; struct ng_btsocket_hci_raw_filter filter; - int s, mib[4]; + int s, mib[4], num; size_t size; struct nodeinfo *nodes; - if (find_hci_nodes(&nodes) == 0) - err(7, "Could not find HCI nodes"); + num = find_hci_nodes(&nodes); + if (num == 0) + errx(7, "Could not find HCI nodes"); if (node == NULL) { node = strdup(nodes[0].name); - fprintf(stdout, "Using HCI node: %s\n", node); + if (num > 1) + fprintf(stdout, "Using HCI node: %s\n", node); } free(nodes);