summaryrefslogtreecommitdiff
path: root/lib/fstree/hardlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fstree/hardlink.c')
-rw-r--r--lib/fstree/hardlink.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/fstree/hardlink.c b/lib/fstree/hardlink.c
index e71670a..11ab566 100644
--- a/lib/fstree/hardlink.c
+++ b/lib/fstree/hardlink.c
@@ -62,9 +62,14 @@ int fstree_resolve_hard_link(fstree_t *fs, tree_node_t *node)
return -1;
}
+ if (node->link_count == 0x0FFFF) {
+ errno = EMLINK;
+ return -1;
+ }
+
start->mode = FSTREE_MODE_HARD_LINK_RESOLVED;
start->data.target_node = node;
- node->link_count += 1;
+ node->link_count++;
return 0;
}