summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-19 16:33:47 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-19 16:34:10 +0100
commitcaa34ed48ba55a50a4187cd1ae307c09c6b75311 (patch)
treed46a0f7e69d4158b4b871e473becbcdfa5d364a5 /lib
parent20ceb65fbc728c6a681ec85ee2a94e93a9e7df0c (diff)
Fix link count for file inodes in tree serialization.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/common/serialize_fstree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/common/serialize_fstree.c b/lib/common/serialize_fstree.c
index 39f8f94..73f4e67 100644
--- a/lib/common/serialize_fstree.c
+++ b/lib/common/serialize_fstree.c
@@ -118,6 +118,13 @@ static int serialize_tree_node(const char *filename, sqfs_writer_t *wr,
inode = n->data.file.user_ptr;
n->data.file.user_ptr = NULL;
ret = SQFS_ERROR_INTERNAL;
+
+ if (inode->base.type == SQFS_INODE_FILE && n->link_count > 1) {
+ sqfs_inode_make_extended(inode);
+ inode->data.file_ext.nlink = n->link_count;
+ } else {
+ inode->data.file_ext.nlink = n->link_count;
+ }
} else {
inode = tree_node_to_inode(n);
ret = SQFS_ERROR_ALLOC;