summaryrefslogtreecommitdiff
path: root/print-tree.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2013-11-04 15:17:41 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:03 -0800
commit1ecefced86538306d581b05105a93d1268ce0028 (patch)
tree2c056cfa051e67a6773add9f2b5b550470f1fdcd /print-tree.c
parent457b1286dd9976efbfec25bb286ddc8cec410aa1 (diff)
downloadbtrfs-progs-1ecefced86538306d581b05105a93d1268ce0028.tar.gz
btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf size
we use 37 as the allocation size to hold the uuid_unparse, here it defines BTRFS_UUID_UNPARSE_SIZE for the same. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'print-tree.c')
-rw-r--r--print-tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/print-tree.c b/print-tree.c
index 76037fe..c52e5da 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -24,6 +24,7 @@
#include "ctree.h"
#include "disk-io.h"
#include "print-tree.h"
+#include "utils.h"
static void print_dir_item_type(struct extent_buffer *eb,
@@ -187,21 +188,21 @@ static void print_dev_item(struct extent_buffer *eb,
static void print_uuids(struct extent_buffer *eb)
{
- char fs_uuid[37];
- char chunk_uuid[37];
+ char fs_uuid[BTRFS_UUID_UNPARSED_SIZE];
+ char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE];
u8 disk_uuid[BTRFS_UUID_SIZE];
read_extent_buffer(eb, disk_uuid, btrfs_header_fsid(),
BTRFS_FSID_SIZE);
- fs_uuid[36] = '\0';
+ fs_uuid[BTRFS_UUID_UNPARSED_SIZE - 1] = '\0';
uuid_unparse(disk_uuid, fs_uuid);
read_extent_buffer(eb, disk_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(eb),
BTRFS_UUID_SIZE);
- chunk_uuid[36] = '\0';
+ chunk_uuid[BTRFS_UUID_UNPARSED_SIZE - 1] = '\0';
uuid_unparse(disk_uuid, chunk_uuid);
printf("fs uuid %s\nchunk uuid %s\n", fs_uuid, chunk_uuid);
}