From: Felix Fietkau Date: Fri, 20 Apr 2018 08:02:28 +0000 (+0200) Subject: mtd: fix erase handling with partition offset on write X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d92ec071b211e0ee17496287f62652beb7db543d;p=openwrt%2Fstaging%2Faparcar.git 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 --- 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);