diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-28 23:15:08 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-28 23:34:17 +0200 |
commit | 95e498a42211836016bff3cddea2204e5de80192 (patch) | |
tree | a57a30c30adabe18635139159f127c657cef60ab | |
parent | 624b9ccf99313dfb2ad2331207fd20b9cb544222 (diff) |
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 <david.oberhollenzer@sigma-star.at>
-rw-r--r-- | lib/sqfs/xattr_writer.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |