[openwrt/openwrt] mtd: fix erase handling with partition offset on write
LEDE Commits
lede-commits at lists.infradead.org
Fri Apr 20 01:05:28 PDT 2018
nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/d92ec071b211e0ee17496287f62652beb7db543d
commit d92ec071b211e0ee17496287f62652beb7db543d
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Apr 20 10:02:28 2018 +0200
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 <nbd at nbd.name>
---
package/system/mtd/src/mtd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c
index 55a3bdb..fa04c0f 100644
--- a/package/system/mtd/src/mtd.c
+++ b/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);
More information about the lede-commits
mailing list