summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-11-24 16:18:34 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-11-24 16:18:34 +0000
commit401f12d020e8ed4921ea75a53c4f7f135b9a7803 (patch)
tree71f8e1c7887dedafb40db68e638c55a0b65108f9
parent8b815e9edf36144b10fc81647af729951fed67f2 (diff)
[package] mtd: fix r24132
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24134 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/mtd/src/mtd.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/package/mtd/src/mtd.c b/package/mtd/src/mtd.c
index e4b6c79f0..5ec79dce0 100644
--- a/package/mtd/src/mtd.c
+++ b/package/mtd/src/mtd.c
@@ -519,35 +519,35 @@ resume:
}
/* need to erase the next block before writing data to it */
- if(no_erase)
- {
- while (w + buflen > e) {
- if (!quiet)
- fprintf(stderr, "\b\b\b[e]");
-
-
- if (mtd_erase_block(fd, e) < 0) {
- if (next) {
- if (w < e) {
- write(fd, buf + offset, e - w);
- offset = e - w;
+ if(!no_erase)
+ {
+ while (w + buflen > e) {
+ if (!quiet)
+ fprintf(stderr, "\b\b\b[e]");
+
+
+ if (mtd_erase_block(fd, e) < 0) {
+ if (next) {
+ if (w < e) {
+ write(fd, buf + 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 */
- e += erasesize;
- }
- }
+ /* erase the chunk */
+ e += erasesize;
+ }
+ }
if (!quiet)
fprintf(stderr, "\b\b\b[w]");
@@ -665,9 +665,9 @@ int main (int argc, char **argv)
case 'r':
boot = 1;
break;
- case 'n':
- no_erase = 1;
- break;
+ case 'n':
+ no_erase = 1;
+ break;
case 'j':
jffs2file = optarg;
break;