* [PATCH] gatttool: Fix handle parsing in cmd_char_write()
@ 2012-04-25 15:25 Andrzej Kaczmarek
2012-04-25 19:35 ` Anderson Lizardo
2012-04-26 9:13 ` Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Andrzej Kaczmarek @ 2012-04-25 15:25 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
errno is not set to 0 before call to strtoll() so cmd_char_write() can fail
even with proper data. Use strtohandle() helper function instead.
---
attrib/interactive.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 0064ba2..073e3f7 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -601,8 +601,8 @@ static void cmd_char_write(int argcp, char **argvp)
return;
}
- handle = strtoll(argvp[1], NULL, 16);
- if (errno != 0 || handle <= 0) {
+ handle = strtohandle(argvp[1]);
+ if (handle <= 0) {
printf("A valid handle is required\n");
return;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gatttool: Fix handle parsing in cmd_char_write()
2012-04-25 15:25 [PATCH] gatttool: Fix handle parsing in cmd_char_write() Andrzej Kaczmarek
@ 2012-04-25 19:35 ` Anderson Lizardo
2012-04-26 9:13 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Anderson Lizardo @ 2012-04-25 19:35 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
Hi Andrzej,
On Wed, Apr 25, 2012 at 11:25 AM, Andrzej Kaczmarek
<andrzej.kaczmarek@tieto.com> wrote:
> errno is not set to 0 before call to strtoll() so cmd_char_write() can fail
> even with proper data. Use strtohandle() helper function instead.
> ---
> attrib/interactive.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Looks good.
Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gatttool: Fix handle parsing in cmd_char_write()
2012-04-25 15:25 [PATCH] gatttool: Fix handle parsing in cmd_char_write() Andrzej Kaczmarek
2012-04-25 19:35 ` Anderson Lizardo
@ 2012-04-26 9:13 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-04-26 9:13 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
Hi Andrzej,
On Wed, Apr 25, 2012, Andrzej Kaczmarek wrote:
> errno is not set to 0 before call to strtoll() so cmd_char_write() can fail
> even with proper data. Use strtohandle() helper function instead.
> ---
> attrib/interactive.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-26 9:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 15:25 [PATCH] gatttool: Fix handle parsing in cmd_char_write() Andrzej Kaczmarek
2012-04-25 19:35 ` Anderson Lizardo
2012-04-26 9:13 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).