summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-28 23:12:51 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-28 23:34:17 +0200
commit624b9ccf99313dfb2ad2331207fd20b9cb544222 (patch)
tree6e7edfe2081bc890fc2c31be775215b476cb3122
parentd677b30e9408e149693c66869d6111fe48819e86 (diff)
Fix xattr writer: handle the case that no attributes where added
If begin/end was called without recording *any* attributes, simply set the resulting index to the 0xFFFFFFFF sentinel. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/sqfs/xattr_writer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqfs/xattr_writer.c b/lib/sqfs/xattr_writer.c
index 318c613..fd35ca3 100644
--- a/lib/sqfs/xattr_writer.c
+++ b/lib/sqfs/xattr_writer.c
@@ -235,6 +235,10 @@ int sqfs_xattr_writer_end(sqfs_xattr_writer_t *xwr, sqfs_u32 *out)
int ret;
count = xwr->num_pairs - xwr->kv_start;
+ if (count == 0) {
+ *out = 0xFFFFFFFF;
+ return 0;
+ }
qsort(xwr->kv_pairs + xwr->kv_start, count,
sizeof(xwr->kv_pairs[0]), compare_u64);