fix: flush SquashFS meta block if *exactely* filled

Otherwise we can get really funky corner cases where an inode offset is
indicated as just 1 byte after the end of a block. The unsquashfs program
doesn't complain but the kernel implementation really doesn't like that.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-04-23 13:52:26 +02:00
parent 7a70868fcd
commit ed6841ed17
1 changed files with 3 additions and 0 deletions

View File

@ -85,5 +85,8 @@ int meta_writer_append(meta_writer_t *m, const void *data, size_t size)
data = (const char *)data + diff;
}
if (m->offset == (sizeof(m->data) - 2))
return meta_writer_flush(m);
return 0;
}