aboutsummaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/mknode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/fstree/mknode.c b/lib/fstree/mknode.c
index 16cfa9c..4353b74 100644
--- a/lib/fstree/mknode.c
+++ b/lib/fstree/mknode.c
@@ -44,6 +44,7 @@ tree_node_t *fstree_mknode(tree_node_t *parent, const char *name,
n->gid = sb->st_gid;
n->mode = sb->st_mode;
n->mod_time = sb->st_mtime;
+ n->link_count = 1;
n->name = (char *)n->payload;
memcpy(n->name, name, name_len);
@@ -66,7 +67,13 @@ tree_node_t *fstree_mknode(tree_node_t *parent, const char *name,
case S_IFCHR:
n->data.devno = sb->st_rdev;
break;
+ case S_IFDIR:
+ n->link_count = 2;
+ break;
}
+ if (parent != NULL)
+ parent->link_count += 1;
+
return n;
}