From ead055c1bc5bf032488d2b71838596a3e355a707 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 29 Mar 2007 13:33:27 +0000 Subject: Lower number of possible interfaces from 48 to 7 and other minor fixes. --- network/common.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'network') 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; } -- cgit