aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;