summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}