summaryrefslogtreecommitdiffstats
path: root/network/common.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-03-29 13:33:27 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-03-29 13:33:27 +0000
commitead055c1bc5bf032488d2b71838596a3e355a707 (patch)
tree8bd0543b932f84ad7c11359cd2f0c19097323e4d /network/common.c
parent9c2ff557a3ffade313dd5dbff6a5b86552ae8208 (diff)
Lower number of possible interfaces from 48 to 7 and other minor fixes.
Diffstat (limited to 'network/common.c')
-rw-r--r--network/common.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/network/common.c b/network/common.c
index c486ad7f..d9f60374 100644
--- a/network/common.c
+++ b/network/common.c
@@ -105,8 +105,10 @@ int bnep_init(void)
ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP);
if (ctl < 0) {
- error("Failed to open control socket");
- return -1;
+ int err = errno;
+ error("Failed to open control socket: %s (%d)",
+ strerror(err), err);
+ return -err;
}
return 0;
@@ -125,8 +127,10 @@ int bnep_kill_connection(bdaddr_t *dst)
baswap((bdaddr_t *)&req.dst, dst);
req.flags = 0;
if (ioctl(ctl, BNEPCONNDEL, &req)) {
- error("Failed to kill connection");
- return -1;
+ int err = errno;
+ error("Failed to kill connection: %s (%d)",
+ strerror(err), err);
+ return -err;
}
return 0;
}
@@ -134,22 +138,24 @@ int bnep_kill_connection(bdaddr_t *dst)
int bnep_kill_all_connections(void)
{
struct bnep_connlist_req req;
- struct bnep_conninfo ci[48];
+ struct bnep_conninfo ci[7];
int i;
- req.cnum = 48;
+ memset(&req, 0, sizeof(req));
+ req.cnum = 7;
req.ci = ci;
if (ioctl(ctl, BNEPGETCONNLIST, &req)) {
- error("Failed to get connection list");
- return -1;
+ int err = errno;
+ error("Failed to get connection list: %s (%d)",
+ strerror(err), err);
+ return -err;
}
for (i=0; i < req.cnum; i++) {
struct bnep_conndel_req req;
memcpy(req.dst, ci[i].dst, ETH_ALEN);
req.flags = 0;
- if (ioctl(ctl, BNEPCONNDEL, &req))
- error("Failed to kill connection");
+ ioctl(ctl, BNEPCONNDEL, &req);
}
return 0;
}