浏览代码

mtd: fix erase handling with partition offset on write

When a partition offset is given, it is used in an lseek call, which
affects write, but not erase. Add it to the offset for erase calls as
well

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 7 年之前
父节点
当前提交
d92ec071b2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      package/system/mtd/src/mtd.c

+ 1 - 1
package/system/mtd/src/mtd.c

@@ -638,7 +638,7 @@ resume:
 					continue;
 				}
 
-				if (mtd_erase_block(fd, e) < 0) {
+				if (mtd_erase_block(fd, e + part_offset) < 0) {
 					if (next) {
 						if (w < e) {
 							write(fd, buf + offset, e - w);