- 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)
This commit is contained in:
Markus Brueffer 2006-06-02 00:29:01 +00:00
parent 4bb0f51d1d
commit 02afd3d137
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159156

View File

@ -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);