aboutsummaryrefslogtreecommitdiff
path: root/lib/common/src
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-20 14:08:34 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-20 14:08:34 +0200
commitc5f0334e87deea2b54f33f62ee879455a814633c (patch)
tree8d384482c8cd29d3ebe5b280b7d853968aff816c /lib/common/src
parentd7be81367997536dceb08a7be0014136a1f89df2 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common/src')
-rw-r--r--lib/common/src/writer/serialize_fstree.c3
1 files changed, 2 insertions, 1 deletions
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;