diff options
author | Tedd Ho-Jeong AN <tedd.an@intel.com> | 2012-07-02 09:52:17 -0700 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-04 15:39:54 +0300 |
commit | 4a3f496862c30d5373f1651c093951a5a42929a4 (patch) | |
tree | 14d675eacf883fa13ee1a886b35d1cf8950c2000 /tools/hciattach_intel.c | |
parent | c301b7650b4d4ad550daa68d4b2a38e62796cc47 (diff) | |
download | bluez-4a3f496862c30d5373f1651c093951a5a42929a4.tar.gz |
hciattach: fix return length after reading the patch file
This patch fixes the issue that returns always 0 after reading the patch
line.
Diffstat (limited to 'tools/hciattach_intel.c')
-rw-r--r-- | tools/hciattach_intel.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/hciattach_intel.c b/tools/hciattach_intel.c index 9129993ae..749098ef9 100644 --- a/tools/hciattach_intel.c +++ b/tools/hciattach_intel.c @@ -148,14 +148,13 @@ static int validate_events(struct patch_entry *event, */ static int get_next_patch_entry(int fd, struct patch_entry *entry) { - int len, size; + int size; char rb; if (read(fd, &rb, 1) <= 0) return 0; entry->type = rb; - len = 0; switch (entry->type) { case PATCH_TYPE_CMD: @@ -176,7 +175,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry) case PATCH_TYPE_EVT: entry->data[0] = HCI_EVENT_PKT; - if (read(fd, &entry->data[len], 2) < 0) + if (read(fd, &entry->data[1], 2) < 0) return -1; size = (int)entry->data[2]; @@ -193,7 +192,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry) return -1; } - return len; + return entry->len; } /** |