Re: [PATCH BlueZ v1 3/7] tools/btgatt-client: Fix read-long-value offset parsing.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arman,

On Mon, Oct 27, 2014 at 4:35 PM, Arman Uguray <armansito@xxxxxxxxxxxx> wrote:
> This patch fixes the way read-long-value command parses the "offset"
> argument by interpreting it as base 10 instead of 16, which is more
> intuitive.
> ---
>  tools/btgatt-client.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
> index b7bfa24..e7cd31c 100644
> --- a/tools/btgatt-client.c
> +++ b/tools/btgatt-client.c
> @@ -486,8 +486,8 @@ static void cmd_read_long_value(struct client *cli, char *cmd_str)
>         }
>
>         endptr = NULL;
> -       offset = strtol(argv[1], &endptr, 16);
> -       if (!endptr || *endptr != '\0' || !handle) {
> +       offset = strtol(argv[1], &endptr, 10);
> +       if (!endptr || *endptr != '\0') {
>                 printf("Invalid offset: %s\n", argv[1]);
>                 return;
>         }
> --
> 2.1.0.rc2.206.gedb03e5

Perhaps we should use base 0 here and let strtol figure what base it is:

'If base is zero or 16, the string may then include a "0x" prefix, and
the number will be read in base 16; otherwise, a zero base is taken as
10 (decimal) unless the next character is '0', in which case it is
taken as 8 (octal).'


-- 
Luiz Augusto von Dentz
--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux