summaryrefslogtreecommitdiff
path: root/tools/firmware-utils/src/trx.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-11-30 18:30:56 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-11-30 18:30:56 +0000
commitb61b447472b6a0a05feeb53f3953c3e8c93105c8 (patch)
tree4e7ffe0394eb2894a3ef456cb65c1e8bd47077ca /tools/firmware-utils/src/trx.c
parent2370126b9b5e139e7be753ffb5a44eda7b68e20d (diff)
downloadmtk-20170518-b61b447472b6a0a05feeb53f3953c3e8c93105c8.zip
mtk-20170518-b61b447472b6a0a05feeb53f3953c3e8c93105c8.tar.gz
mtk-20170518-b61b447472b6a0a05feeb53f3953c3e8c93105c8.tar.bz2
firmware-utils/trx: fix two bugs
- fix crc32 calculation if -F was enabled. - don't convert the crc32 to little endian twice. Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> SVN-Revision: 38962
Diffstat (limited to 'tools/firmware-utils/src/trx.c')
-rw-r--r--tools/firmware-utils/src/trx.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/trx.c b/tools/firmware-utils/src/trx.c
index 8e95d98..e3b6a39 100644
--- a/tools/firmware-utils/src/trx.c
+++ b/tools/firmware-utils/src/trx.c
@@ -273,11 +273,10 @@ int main(int argc, char **argv)
}
p->crc32 = crc32buf((char *) &p->flag_version,
- (fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version));
+ ((fsmark)?fsmark:cur_len) - offsetof(struct trx_header, flag_version));
p->crc32 = STORE32_LE(p->crc32);
p->len = STORE32_LE((fsmark) ? fsmark : cur_len);
- p->len = STORE32_LE(p->len);
/* restore TRXv2 bin-header */
if (trx_version == 2) {