summaryrefslogtreecommitdiff
path: root/btrfs-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'btrfs-list.c')
-rw-r--r--btrfs-list.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/btrfs-list.c b/btrfs-list.c
index 5f4a9bea..35e61392 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -183,6 +183,8 @@ static int add_root(struct root_lookup *root_lookup,
ri->root_id = root_id;
ri->ref_tree = ref_tree;
strncpy(ri->name, name, name_len);
+ if (name_len > 0)
+ ri->name[name_len-1] = 0;
ret = tree_insert(&root_lookup->root, root_id, ref_tree, &ri->rb_node);
if (ret) {