aboutsummaryrefslogtreecommitdiffstats
path: root/dir-test.c
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@bisect.de>2013-01-21 16:57:25 +0100
committerDavid Sterba <dsterba@suse.cz>2013-01-21 18:27:54 +0100
commitc88c2f52fed9554306036385c5c15c012ba49629 (patch)
tree09ea4e3d647ebdfd9e1a66401d377a173d9369d2 /dir-test.c
parent0db197d8b2d2ab7214a2425c3c646e970e4085c8 (diff)
downloadbtrfs-progs-c88c2f52fed9554306036385c5c15c012ba49629.tar.gz
btrfs-progs-c88c2f52fed9554306036385c5c15c012ba49629.tar.xz
btrfs-progs-c88c2f52fed9554306036385c5c15c012ba49629.zip
btrfs-progs: Handle errors returned from open_ctree
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'dir-test.c')
-rw-r--r--dir-test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dir-test.c b/dir-test.c
index 3ae9c68..c7644d6 100644
--- a/dir-test.c
+++ b/dir-test.c
@@ -436,6 +436,12 @@ int main(int ac, char **av)
radix_tree_init();
root = open_ctree(av[ac-1], &super, 0);
+
+ if (!root) {
+ fprintf(stderr, "Open ctree failed\n");
+ return 1;
+ }
+
trans = btrfs_start_transaction(root, 1);
dir_oid = btrfs_super_root_dir(&super);
@@ -479,6 +485,11 @@ int main(int ac, char **av)
btrfs_header_nritems(&root->node->node.header));
close_ctree(root, &super);
root = open_ctree("dbfile", &super, 0);
+
+ if (!root) {
+ fprintf(stderr, "Open ctree failed\n");
+ return 1;
+ }
}
while(count--) {
ret = ops[op](trans, root, &radix);