aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libmtd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 60b4782..bf6d71f 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -1072,10 +1072,10 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
mtd->mtd_num, seek);
while (rd < len) {
- ret = read(fd, buf, len);
+ ret = read(fd, buf + rd, len - rd);
if (ret < 0)
return sys_errmsg("cannot read %d bytes from mtd%d (eraseblock %d, offset %d)",
- len, mtd->mtd_num, eb, offs);
+ len - rd, mtd->mtd_num, eb, offs + rd);
rd += ret;
}