summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/fstree/mknode.c1
-rw-r--r--tests/mknode_slink.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/fstree/mknode.c b/lib/fstree/mknode.c
index 247e2b5..e4620f5 100644
--- a/lib/fstree/mknode.c
+++ b/lib/fstree/mknode.c
@@ -57,6 +57,7 @@ tree_node_t *fstree_mknode(fstree_t *fs, tree_node_t *parent, const char *name,
strcpy(n->data.file->input_file, extra);
break;
case S_IFLNK:
+ n->mode = S_IFLNK | 0777;
n->data.slink_target = (char *)n->payload;
strcpy(n->data.slink_target, extra);
break;
diff --git a/tests/mknode_slink.c b/tests/mknode_slink.c
index 1cea92d..6dbccc8 100644
--- a/tests/mknode_slink.c
+++ b/tests/mknode_slink.c
@@ -22,7 +22,7 @@ int main(void)
node = fstree_mknode(&fs, NULL, "symlink", 7, "target", &sb);
assert(node->uid == sb.st_uid);
assert(node->gid == sb.st_gid);
- assert(node->mode == sb.st_mode);
+ assert(node->mode == (S_IFLNK | 0777));
assert(node->parent == NULL);
assert((char *)node->name >= (char *)node->payload);
assert(node->data.slink_target >= (char *)node->payload);
@@ -34,7 +34,7 @@ int main(void)
node = fstree_mknode(&fs, NULL, "symlink", 7, "", &sb);
assert(node->uid == sb.st_uid);
assert(node->gid == sb.st_gid);
- assert(node->mode == sb.st_mode);
+ assert(node->mode == (S_IFLNK | 0777));
assert(node->parent == NULL);
assert((char *)node->name >= (char *)node->payload);
assert(node->data.slink_target >= (char *)node->payload);