summaryrefslogtreecommitdiff
path: root/cmds-replace.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2013-12-18 12:07:55 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:21 -0800
commitd89437893266332cce295c06c9d00b79aa5b4dd6 (patch)
tree415b50a673c6c6e49c5bc3403f654ddd5631b9ab /cmds-replace.c
parentb5a09775c6e3dd6c842764b026e1764a057b7dfd (diff)
btrfs-progs: handle error in the btrfs_prepare_device
this patch will handle the strerror reporting of the error instead of printing errno, and also replaced the BUG_ON with the error handling 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 'cmds-replace.c')
-rw-r--r--cmds-replace.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmds-replace.c b/cmds-replace.c
index d9b0940e..c683d6c4 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -276,12 +276,11 @@ static int cmd_start_replace(int argc, char **argv)
}
strncpy((char *)start_args.start.tgtdev_name, dstdev,
BTRFS_DEVICE_PATH_NAME_MAX);
- if (btrfs_prepare_device(fddstdev, dstdev, 1, &dstdev_block_count, 0,
- &mixed, 0)) {
- fprintf(stderr, "Error: Failed to prepare device '%s'\n",
- dstdev);
+ ret = btrfs_prepare_device(fddstdev, dstdev, 1, &dstdev_block_count, 0,
+ &mixed, 0);
+ if (ret)
goto leave_with_error;
- }
+
close(fddstdev);
fddstdev = -1;