btrfs-progs: mkfs: catch errors after transaction start

Replace missing or BUG_ON in main().

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2015-07-11 00:18:21 +02:00
parent a5afa55a30
commit 8cb5ff857a

9
mkfs.c
View File

@ -1697,7 +1697,10 @@ int main(int ac, char **av)
}
trans = btrfs_start_transaction(root, 1);
BUG_ON(!trans);
if (!trans) {
fprintf(stderr, "failed to start transaction\n");
exit(1);
}
ret = create_data_block_groups(trans, root, mixed, &allocation);
if (ret) {
@ -1714,6 +1717,10 @@ int main(int ac, char **av)
btrfs_commit_transaction(trans, root);
trans = btrfs_start_transaction(root, 1);
if (!trans) {
fprintf(stderr, "failed to start transaction\n");
exit(1);
}
if (is_block_device(file))
btrfs_register_one_device(file);