diff options
Diffstat (limited to 'lib/tar')
-rw-r--r-- | lib/tar/src/padd_file.c | 2 | ||||
-rw-r--r-- | lib/tar/test/tar_write_simple.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/tar/src/padd_file.c b/lib/tar/src/padd_file.c index 053ff1e..0f6ee0a 100644 --- a/lib/tar/src/padd_file.c +++ b/lib/tar/src/padd_file.c @@ -15,5 +15,5 @@ int padd_file(ostream_t *fp, sqfs_u64 size) if (padd_sz == 0) return 0; - return ostream_append_sparse(fp, TAR_RECORD_SIZE - padd_sz); + return fp->append(fp, NULL, TAR_RECORD_SIZE - padd_sz); } diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c index 2302307..b34c9c5 100644 --- a/lib/tar/test/tar_write_simple.c +++ b/lib/tar/test/tar_write_simple.c @@ -21,7 +21,6 @@ static ostream_t mem_stream = { { 1, NULL, NULL }, buffer_append, NULL, - NULL, buffer_get_filename, }; @@ -33,12 +32,16 @@ static sqfs_u8 rd_buffer[1024 * 10]; static int buffer_append(ostream_t *strm, const void *data, size_t size) { TEST_ASSERT(strm == &mem_stream); - TEST_NOT_NULL(data); TEST_ASSERT(wr_offset < sizeof(wr_buffer)); TEST_ASSERT(size > 0); TEST_ASSERT((sizeof(wr_buffer) - wr_offset) >= size); - memcpy(wr_buffer + wr_offset, data, size); + if (data == NULL) { + memset(wr_buffer + wr_offset, 0, size); + } else { + memcpy(wr_buffer + wr_offset, data, size); + } + wr_offset += size; return 0; } |