aboutsummaryrefslogtreecommitdiffstats
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
commitb081ab6866aee2f1c2adc5d1f0462f9a8b6c5ab6 (patch)
treeb19bf7f17a4c44f1daa4a5892ac26ea33d1fa5c3
parent31e109fa423a31ae0545c915331a7e7497513ec1 (diff)
downloadupstream-b081ab6866aee2f1c2adc5d1f0462f9a8b6c5ab6.tar.gz
upstream-b081ab6866aee2f1c2adc5d1f0462f9a8b6c5ab6.tar.bz2
upstream-b081ab6866aee2f1c2adc5d1f0462f9a8b6c5ab6.zip
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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38962 3c298f89-4303-0410-b956-a3cf2f4a3e73
-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 8e95d98d7a..e3b6a3941f 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) {