aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/mtd/src/seama.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-06-11 01:41:10 +0200
committerRafał Miłecki <zajec5@gmail.com>2016-06-20 08:01:31 +0200
commit7e08f2ccbdb717c502810085457b824d0f2d067b (patch)
treeb4722ba8a21c5f1cb98b491a7134cf055c2b7bfe /package/system/mtd/src/seama.c
parentcf6d9d97fbaa7d85b0f972bdc7ad710e96125fd2 (diff)
downloadupstream-7e08f2ccbdb717c502810085457b824d0f2d067b.tar.gz
upstream-7e08f2ccbdb717c502810085457b824d0f2d067b.tar.bz2
upstream-7e08f2ccbdb717c502810085457b824d0f2d067b.zip
mtd: support -c (datasize) option for fixseama command
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Diffstat (limited to 'package/system/mtd/src/seama.c')
-rw-r--r--package/system/mtd/src/seama.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/package/system/mtd/src/seama.c b/package/system/mtd/src/seama.c
index f8b677b189..bcda321918 100644
--- a/package/system/mtd/src/seama.c
+++ b/package/system/mtd/src/seama.c
@@ -104,14 +104,13 @@ err_out:
}
int
-mtd_fixseama(const char *mtd, size_t offset)
+mtd_fixseama(const char *mtd, size_t offset, size_t data_size)
{
int fd;
char *first_block;
ssize_t res;
size_t block_offset;
size_t data_offset;
- size_t data_size;
struct seama_entity_header *shdr;
if (quiet < 2)
@@ -155,7 +154,8 @@ mtd_fixseama(const char *mtd, size_t offset)
}
data_offset = offset + sizeof(struct seama_entity_header) + ntohs(shdr->metasize);
- data_size = mtdsize - data_offset;
+ if (!data_size)
+ data_size = mtdsize - data_offset;
if (data_size > ntohl(shdr->size))
data_size = ntohl(shdr->size);
if (seama_fix_md5(shdr, fd, data_offset, data_size))