OSDN Git Service

gatttool: Fix handle parsing in cmd_char_write()
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Wed, 25 Apr 2012 15:25:19 +0000 (17:25 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 26 Apr 2012 09:12:18 +0000 (12:12 +0300)
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

index 0064ba2..073e3f7 100644 (file)
@@ -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;
        }