2015-02-20 13:22:58

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH] tools/gatt: Fix incorrect error check

From: Andrei Emeltchenko <[email protected]>

---
tools/btgatt-client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index e59d5db..25ace4a 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -1021,7 +1021,7 @@ static void cmd_set_sec_level(struct client *cli, char *cmd_str)
return;
}

- if (bt_gatt_client_set_sec_level(cli->gatt, level) < 0)
+ if (!bt_gatt_client_set_sec_level(cli->gatt, level))
printf("Could not set sec level\n");
else
printf("Setting security level %d success\n", level);
--
2.1.0



2015-02-24 16:49:32

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH] tools/gatt: Fix incorrect error check

Hi Andrei,

On Friday 20 of February 2015 15:22:58 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> ---
> tools/btgatt-client.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
> index e59d5db..25ace4a 100644
> --- a/tools/btgatt-client.c
> +++ b/tools/btgatt-client.c
> @@ -1021,7 +1021,7 @@ static void cmd_set_sec_level(struct client *cli, char *cmd_str)
> return;
> }
>
> - if (bt_gatt_client_set_sec_level(cli->gatt, level) < 0)
> + if (!bt_gatt_client_set_sec_level(cli->gatt, level))
> printf("Could not set sec level\n");
> else
> printf("Setting security level %d success\n", level);
>

Patch applied, thanks.

--
Best regards,
Szymon Janc