aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/mtd/src/mtd.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-04-20 10:02:28 +0200
committerFelix Fietkau <nbd@nbd.name>2018-04-20 10:03:38 +0200
commitd92ec071b211e0ee17496287f62652beb7db543d (patch)
tree13f72f2f0d89e53ce1097969727c6464523dfb5b /package/system/mtd/src/mtd.c
parentbc43f75defee6786b1d63131f576ef053eae87a6 (diff)
downloadupstream-d92ec071b211e0ee17496287f62652beb7db543d.tar.gz
upstream-d92ec071b211e0ee17496287f62652beb7db543d.tar.bz2
upstream-d92ec071b211e0ee17496287f62652beb7db543d.zip
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@nbd.name>
Diffstat (limited to 'package/system/mtd/src/mtd.c')
-rw-r--r--package/system/mtd/src/mtd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c
index 55a3bdba81..fa04c0f95b 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);