diff options
author | Max Reitz <mreitz@redhat.com> | 2013-09-06 17:14:26 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-09-12 10:12:48 +0200 |
commit | cc84d90ff54c025190dbe49ec5fea1268217c5f2 (patch) | |
tree | 44541b52ece4f55b5678087f83f3eb6cd91774aa /qemu-img.c | |
parent | 34b5d2c68eb4082c288e70fb99c61af8f7b96fde (diff) |
block: Error parameter for create functions
Add an Error ** parameter to bdrv_create and its associated functions to
allow more specific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/qemu-img.c b/qemu-img.c index 49ff06869e..ccb0468d94 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1139,6 +1139,7 @@ static int img_convert(int argc, char **argv) float local_progress = 0; int min_sparse = 8; /* Need at least 4k of zeros for sparse detection */ bool quiet = false; + Error *local_err = NULL; fmt = NULL; out_fmt = "raw"; @@ -1341,18 +1342,11 @@ static int img_convert(int argc, char **argv) if (!skip_create) { /* Create the new image */ - ret = bdrv_create(drv, out_filename, param); + ret = bdrv_create(drv, out_filename, param, &local_err); if (ret < 0) { - if (ret == -ENOTSUP) { - error_report("Formatting not supported for file format '%s'", - out_fmt); - } else if (ret == -EFBIG) { - error_report("The image size is too large for file format '%s'", - out_fmt); - } else { - error_report("%s: error while converting %s: %s", - out_filename, out_fmt, strerror(-ret)); - } + error_report("%s: error while converting %s: %s", + out_filename, out_fmt, error_get_pretty(local_err)); + error_free(local_err); goto out; } } |