From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> This avoids double printing the same error with bnep connection add ioctl. --- profiles/network/bnep.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c index 136709d..035beb1 100644 --- a/profiles/network/bnep.c +++ b/profiles/network/bnep.c @@ -316,10 +316,8 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond, setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo)); sk = g_io_channel_unix_get_fd(session->io); - if (bnep_connadd(sk, session->src, session->iface)) { - error("bnep conn could not be added"); + if (bnep_connadd(sk, session->src, session->iface) < 0) goto failed; - } if (bnep_if_up(session->iface)) { error("could not up %s", session->iface); @@ -556,14 +554,14 @@ static int bnep_del_from_bridge(const char *devname, const char *bridge) int bnep_server_add(int sk, uint16_t dst, char *bridge, char *iface, const bdaddr_t *addr) { + int err; + if (!bridge || !iface || !addr) return -EINVAL; - if (bnep_connadd(sk, dst, iface) < 0) { - error("Can't add connection to the bridge %s: %s(%d)", - bridge, strerror(errno), errno); - return -errno; - } + err = bnep_connadd(sk, dst, iface); + if (err < 0) + return err; if (bnep_add_to_bridge(iface, bridge) < 0) { error("Can't add %s to the bridge %s: %s(%d)", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html