aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-28 15:04:04 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-28 15:07:29 +0200
commit0b78208a5b92517769043aff4dfcba0b67fa8f6e (patch)
tree34f6f1a22883e2d325a71699f4f71548b7a1f824 /lib/sqfs
parent8ac60e9b961f12acfe300258700522b02c06a50c (diff)
Ommit fragment table if there really are no fragments
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-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,