From c5f0334e87deea2b54f33f62ee879455a814633c Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 20 Apr 2023 14:08:34 +0200 Subject: libfstree: Remove special modes for hard links Instead of adding special sentinel modes, simply treat hard links as special case of symlinks, setting a flag to indicate that it is a hard link and another flag to indicate that it has been resolved. Signed-off-by: David Oberhollenzer --- lib/common/src/writer/serialize_fstree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/common/src') diff --git a/lib/common/src/writer/serialize_fstree.c b/lib/common/src/writer/serialize_fstree.c index 7ecd850..b5151f3 100644 --- a/lib/common/src/writer/serialize_fstree.c +++ b/lib/common/src/writer/serialize_fstree.c @@ -35,6 +35,7 @@ static sqfs_inode_generic_t *tree_node_to_inode(tree_node_t *node) inode->data.ipc.nlink = node->link_count; break; case S_IFLNK: + assert(!(node->flags & FLAG_LINK_IS_HARD)); inode->base.type = SQFS_INODE_SLINK; inode->data.slink.nlink = node->link_count; inode->data.slink.target_size = extra; @@ -71,7 +72,7 @@ static sqfs_inode_generic_t *write_dir_entries(const char *filename, goto fail; for (it = node->data.children; it != NULL; it = it->next) { - if (it->mode == FSTREE_MODE_HARD_LINK_RESOLVED) { + if (S_ISLNK(it->mode) && (it->flags & FLAG_LINK_IS_HARD)) { tgt = it->data.target_node; } else { tgt = it; -- cgit v1.2.3