aboutsummaryrefslogtreecommitdiffstats
path: root/random-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 /random-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 'random-test.c')
-rw-r--r--random-test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/random-test.c b/random-test.c
index 0003236..3a07e6d 100644
--- a/random-test.c
+++ b/random-test.c
@@ -356,6 +356,10 @@ int main(int ac, char **av)
struct btrfs_trans_handle *trans;
radix_tree_init();
root = open_ctree("dbfile", &super);
+ if (!root) {
+ fprintf(stderr, "Open ctree failed\n");
+ exit(1);
+ }
fill_radix(root, &radix);
signal(SIGTERM, sigstopper);
@@ -398,6 +402,10 @@ int main(int ac, char **av)
btrfs_header_nritems(&root->node->node.header));
close_ctree(root, &super);
root = open_ctree("dbfile", &super);
+ if (!root) {
+ fprintf(stderr, "Open ctree failed\n");
+ goto out;
+ }
}
while(count--) {
ret = ops[op](trans, root, &radix);