aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/mtd/src/jffs2.c
diff options
context:
space:
mode:
Diffstat (limited to 'package/system/mtd/src/jffs2.c')
-rw-r--r--package/system/mtd/src/jffs2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/system/mtd/src/jffs2.c b/package/system/mtd/src/jffs2.c
index 2a83bd47f4..c29fb33e5c 100644
--- a/package/system/mtd/src/jffs2.c
+++ b/package/system/mtd/src/jffs2.c
@@ -59,6 +59,15 @@ static void pad(int size)
}
ofs = ofs % erasesize;
if (ofs == 0) {
+ while (mtd_block_is_bad(outfd, mtdofs) && (mtdofs < mtdsize)) {
+ if (!quiet)
+ fprintf(stderr, "\nSkipping bad block at 0x%08x ", mtdofs);
+
+ mtdofs += erasesize;
+
+ /* Move the file pointer along over the bad block. */
+ lseek(outfd, erasesize, SEEK_CUR);
+ }
mtd_erase_block(outfd, mtdofs);
write(outfd, buf, erasesize);
mtdofs += erasesize;