From 1a41bebe0402d521ab597972f09418c440a1e3a6 Mon Sep 17 00:00:00 2001 From: Matlo Date: Thu, 17 Jul 2014 13:08:41 +0200 Subject: [PATCH] Suggest stopping the bluetooth service in case bind returns EADDRINUSE. --- core/connectors/l2cap_con.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/connectors/l2cap_con.c b/core/connectors/l2cap_con.c index 87218ca7..e198eeff 100644 --- a/core/connectors/l2cap_con.c +++ b/core/connectors/l2cap_con.c @@ -335,7 +335,15 @@ int l2cap_listen(unsigned short psm, int options) if(bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) < 0) { - perror("bind"); + if(errno == EADDRINUSE) + { + fprintf(stderr, "bind: Address already in use\n"); + fprintf(stderr, "please stop the bluetooth service\n"); + } + else + { + perror("bind"); + } close(s); return -1; }