If bnep server add will not proceed successfully, approperiate error
should be returned. Now it returns error if control message send will
fail.
---
profiles/network/bnep.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index adddc33..779c5fb 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -650,6 +650,7 @@ int bnep_server_add(int sk, char *bridge, char *iface, const bdaddr_t *addr,
/* Processing BNEP_SETUP_CONNECTION_REQUEST_MSG */
rsp = bnep_setup_decode(sk, req, &dst);
if (rsp != BNEP_SUCCESS) {
+ err = -rsp;
error("bnep: error while decoding setup connection request: %d",
rsp);
goto reply;
@@ -673,10 +674,11 @@ int bnep_server_add(int sk, char *bridge, char *iface, const bdaddr_t *addr,
rsp = BNEP_CONN_NOT_ALLOWED;
reply:
- err = bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp);
- if (err < 0)
+ if (bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp) < 0) {
+ err = -errno;
error("bnep: send ctrl rsp error: %s (%d)", strerror(errno),
errno);
+ }
return err;
}
--
2.1.0
Hi Grzegorz,
On Thursday 12 of March 2015 17:15:26 Grzegorz Kolodziejczyk wrote:
> If bnep server add will not proceed successfully, approperiate error
> should be returned. Now it returns error if control message send will
> fail.
> ---
> profiles/network/bnep.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
> index adddc33..779c5fb 100644
> --- a/profiles/network/bnep.c
> +++ b/profiles/network/bnep.c
> @@ -650,6 +650,7 @@ int bnep_server_add(int sk, char *bridge, char *iface,
> const bdaddr_t *addr, /* Processing BNEP_SETUP_CONNECTION_REQUEST_MSG */
> rsp = bnep_setup_decode(sk, req, &dst);
> if (rsp != BNEP_SUCCESS) {
> + err = -rsp;
> error("bnep: error while decoding setup connection request: %d",
> rsp);
> goto reply;
> @@ -673,10 +674,11 @@ int bnep_server_add(int sk, char *bridge, char *iface,
> const bdaddr_t *addr, rsp = BNEP_CONN_NOT_ALLOWED;
>
> reply:
> - err = bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp);
> - if (err < 0)
> + if (bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp) < 0) {
> + err = -errno;
> error("bnep: send ctrl rsp error: %s (%d)", strerror(errno),
> errno);
> + }
>
> return err;
> }
Patch applied, thanks.
--
BR
Szymon Janc
Hi Grzegorz,
On Thursday 12 of March 2015 17:06:36 Grzegorz Kolodziejczyk wrote:
> If bnep server add will not proceed successfully, approperiate error
> should be returned. Now it returns error if control message send will
> fail.
> ---
> profiles/network/bnep.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
> index adddc33..48926b4 100644
> --- a/profiles/network/bnep.c
> +++ b/profiles/network/bnep.c
> @@ -650,6 +650,7 @@ int bnep_server_add(int sk, char *bridge, char *iface,
> const bdaddr_t *addr, /* Processing BNEP_SETUP_CONNECTION_REQUEST_MSG */
> rsp = bnep_setup_decode(sk, req, &dst);
> if (rsp != BNEP_SUCCESS) {
> + err = -rsp;
> error("bnep: error while decoding setup connection request: %d",
> rsp);
> goto reply;
> @@ -673,10 +674,11 @@ int bnep_server_add(int sk, char *bridge, char *iface,
> const bdaddr_t *addr, rsp = BNEP_CONN_NOT_ALLOWED;
>
> reply:
> - err = bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp);
> - if (err < 0)
> + if (bnep_send_ctrl_rsp(sk, BNEP_SETUP_CONN_RSP, rsp) < 0) {
> error("bnep: send ctrl rsp error: %s (%d)", strerror(errno),
> errno);
> + err = -errno;
errno should be saved before calling error().
> + }
>
> return err;
> }
--
BR
Szymon Janc