Ticket #5652 now contains a patch, attached here, to fix the following: sysupgrade save the configuration in sysupgrade.tgz but that file never gets restored on reboot after flashing a new firmware image, so configuration changes are always lost across firmware upgrades.
The attached patch fixes the offending failing component which is mtd -j. It was a simple C coding error in with sizeof(#define) was taken when sizeof returns the size of a type not an object. Since the #define was a byte string the size was 1 instead of 4 (the length of the JFFS2 DEADC0DE marker). I replace sizeof with another define for the length of the marker. -- And that's my crabbing done for the day. Got it out of the way early, now I have the rest of the afternoon to sniff fragrant tea-roses or strangle cute bunnies or something. -- Michael Devore GnuPG Key Fingerprint 86 F5 81 A5 D4 2E 1F 1C http://gnupg.org The C Shore (Daniel Dickinson's Website) http://www.bmts.com/~cshore
Index: package/mtd/src/mtd.c =================================================================== --- package/mtd/src/mtd.c (revision 17187) +++ package/mtd/src/mtd.c (working copy) @@ -285,7 +285,7 @@ break; if (jffs2file) { - if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF)) == 0) { + if (memcmp(buf, JFFS2_EOF, JFFS2_EOF_LEN) == 0) { if (!quiet) fprintf(stderr, "\b\b\b "); if (quiet < 2) Index: package/mtd/src/mtd.h =================================================================== --- package/mtd/src/mtd.h (revision 17187) +++ package/mtd/src/mtd.h (working copy) @@ -8,6 +8,7 @@ #endif #define JFFS2_EOF "\xde\xad\xc0\xde" +#define JFFS2_EOF_LEN 4 extern int quiet; extern int mtdsize; Index: package/mtd/src/jffs2.c =================================================================== --- package/mtd/src/jffs2.c (revision 17187) +++ package/mtd/src/jffs2.c (working copy) @@ -222,7 +222,7 @@ pad(erasesize); /* add eof marker, pad to eraseblock size and write the data */ - add_data(JFFS2_EOF, sizeof(JFFS2_EOF) - 1); + add_data(JFFS2_EOF, JFFS2_EOF_LEN - 1); pad(erasesize); free(buf); @@ -324,7 +324,7 @@ pad(erasesize); /* add eof marker, pad to eraseblock size and write the data */ - add_data(JFFS2_EOF, sizeof(JFFS2_EOF) - 1); + add_data(JFFS2_EOF, JFFS2_EOF_LEN - 1); pad(erasesize); err = 0;
signature.asc
Description: PGP signature
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel