1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 01:01:52 +02:00

[package] mtd: fix r24132

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24134 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2010-11-24 16:18:34 +00:00
parent 8b815e9edf
commit 401f12d020

View File

@ -519,35 +519,35 @@ resume:
} }
/* need to erase the next block before writing data to it */ /* need to erase the next block before writing data to it */
if(no_erase) if(!no_erase)
{ {
while (w + buflen > e) { while (w + buflen > e) {
if (!quiet) if (!quiet)
fprintf(stderr, "\b\b\b[e]"); fprintf(stderr, "\b\b\b[e]");
if (mtd_erase_block(fd, e) < 0) { if (mtd_erase_block(fd, e) < 0) {
if (next) { if (next) {
if (w < e) { if (w < e) {
write(fd, buf + offset, e - w); write(fd, buf + offset, e - w);
offset = e - w; offset = e - w;
}
w = 0;
e = 0;
close(fd);
mtd = next;
fprintf(stderr, "\b\b\b \n");
goto resume;
} else {
fprintf(stderr, "Failed to erase block\n");
exit(1);
} }
w = 0;
e = 0;
close(fd);
mtd = next;
fprintf(stderr, "\b\b\b \n");
goto resume;
} else {
fprintf(stderr, "Failed to erase block\n");
exit(1);
} }
}
/* erase the chunk */ /* erase the chunk */
e += erasesize; e += erasesize;
} }
} }
if (!quiet) if (!quiet)
fprintf(stderr, "\b\b\b[w]"); fprintf(stderr, "\b\b\b[w]");
@ -665,9 +665,9 @@ int main (int argc, char **argv)
case 'r': case 'r':
boot = 1; boot = 1;
break; break;
case 'n': case 'n':
no_erase = 1; no_erase = 1;
break; break;
case 'j': case 'j':
jffs2file = optarg; jffs2file = optarg;
break; break;