diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-04-20 10:02:28 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-04-20 10:03:38 +0200 |
commit | d92ec071b211e0ee17496287f62652beb7db543d (patch) | |
tree | 13f72f2f0d89e53ce1097969727c6464523dfb5b /package/system/mtd | |
parent | bc43f75defee6786b1d63131f576ef053eae87a6 (diff) | |
download | upstream-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')
-rw-r--r-- | package/system/mtd/src/mtd.c | 2 |
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); |