John Snow <js...@redhat.com> writes: > On 02/16/2015 09:44 AM, Markus Armbruster wrote: >> add_old_style_options() for img_convert() and img_resize() use >> qemu_opt_set(), which reports errors with qerror_report_err(). Its >> error messages aren't helpful here, the caller reports one that >> actually makes sense. Reproducer: >> >> $ qemu-img convert -B raw in.img out.img >> qemu-img: Invalid parameter 'backing_file' >> qemu-img: Backing file not supported for file format 'raw' >> >> Switch to qemu_opt_set_err() to get rid of the unwanted messages. >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> --- >> qemu-img.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/qemu-img.c b/qemu-img.c >> index 7eea84a..7a806bc 100644 >> --- a/qemu-img.c >> +++ b/qemu-img.c [...] >> @@ -2830,8 +2837,9 @@ static int img_resize(int argc, char **argv) >> >> /* Parse size */ >> param = qemu_opts_create(&resize_options, NULL, 0, &error_abort); >> - if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) { >> - /* Error message already printed when size parsing fails */ >> + qemu_opt_set_err(param, BLOCK_OPT_SIZE, size, &err); >> + if (err) { >> + error_report_err(err); > > Creates a new warning/failure for me, if basing off of origin/master > or kevin/block: > > CC qemu-img.o > /home/bos/jhuston/src/qemu/qemu-img.c: In function ‘img_resize’: > /home/bos/jhuston/src/qemu/qemu-img.c:2844:9: error: implicit > declaration of function ‘error_report_err’ > [-Werror=implicit-function-declaration] > error_report_err(err); > ^ > /home/bos/jhuston/src/qemu/qemu-img.c:2844:9: error: nested extern > declaration of ‘error_report_err’ [-Werror=nested-externs] > cc1: all warnings being treated as errors > make: *** [qemu-img.o] Error 1 > make: *** Waiting for unfinished jobs....
You need my "[PATCH v2 01/10] error: New convenience function error_report_err()", but I forgot to mention it in my cover letter. My apologies. [...]