diff --git a/qemu-img.c b/qemu-img.c index d4a3b4ebcf..2864cb8204 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -645,6 +645,7 @@ static int img_convert(int argc, char **argv) const uint8_t *buf1; BlockDriverInfo bdi; QEMUOptionParameter *param = NULL, *create_options = NULL; + QEMUOptionParameter *out_baseimg_param; char *options = NULL; const char *snapshot_name = NULL; @@ -769,6 +770,12 @@ static int img_convert(int argc, char **argv) goto out; } + /* Get backing file name if -o backing_file was used */ + out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE); + if (out_baseimg_param) { + out_baseimg = out_baseimg_param->value.s; + } + /* Check if compression is supported */ if (flags & BLOCK_FLAG_COMPRESS) { QEMUOptionParameter *encryption =