diff options
author | Danny Kukawka <danny.kukawka@bisect.de> | 2013-01-21 16:57:25 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-01-21 18:27:54 +0100 |
commit | c88c2f52fed9554306036385c5c15c012ba49629 (patch) | |
tree | 09ea4e3d647ebdfd9e1a66401d377a173d9369d2 /dir-test.c | |
parent | 0db197d8b2d2ab7214a2425c3c646e970e4085c8 (diff) | |
download | btrfs-progs-c88c2f52fed9554306036385c5c15c012ba49629.tar.gz btrfs-progs-c88c2f52fed9554306036385c5c15c012ba49629.tar.bz2 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.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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); |