aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqfs/data_writer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqfs/data_writer.c b/lib/sqfs/data_writer.c
index a11e572..753e5d4 100644
--- a/lib/sqfs/data_writer.c
+++ b/lib/sqfs/data_writer.c
@@ -83,6 +83,9 @@ int data_writer_flush_fragments(data_writer_t *data)
uint64_t offset;
uint32_t out;
+ if (data->frag_offset == 0)
+ return 0;
+
if (grow_fragment_table(data))
return -1;
@@ -187,6 +190,12 @@ int data_writer_write_fragment_table(data_writer_t *data)
{
uint64_t start;
+ if (data->num_fragments == 0) {
+ data->super->fragment_entry_count = 0;
+ data->super->fragment_table_start = 0xFFFFFFFFFFFFFFFFUL;
+ return 0;
+ }
+
data->super->fragment_entry_count = data->num_fragments;
if (sqfs_write_table(data->outfd, data->super, data->fragments,