From 95e498a42211836016bff3cddea2204e5de80192 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 28 Sep 2019 23:15:08 +0200 Subject: Fix xattr writer: don't generate an xattr table if there is none If there were no key-value pairs recoreded during the lifetime of the xattr writer, take a short cut out of the flush function and set the super block values to indicate that. Signed-off-by: David Oberhollenzer --- lib/sqfs/xattr_writer.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqfs') diff --git a/lib/sqfs/xattr_writer.c b/lib/sqfs/xattr_writer.c index fd35ca3..0360abc 100644 --- a/lib/sqfs/xattr_writer.c +++ b/lib/sqfs/xattr_writer.c @@ -566,6 +566,12 @@ int sqfs_xattr_writer_flush(sqfs_xattr_writer_t *xwr, sqfs_file_t *file, size_t i, count; int err; + if (xwr->num_pairs == 0 || xwr->num_blocks == 0) { + super->xattr_id_table_start = 0xFFFFFFFFFFFFFFFFUL; + super->flags |= SQFS_FLAG_NO_XATTRS; + return 0; + } + mw = sqfs_meta_writer_create(file, cmp, 0); if (mw == NULL) return SQFS_ERROR_ALLOC; -- cgit v1.2.3