On 12/17/2015 09:50 AM, Markus Armbruster wrote:
> The arguments of error_setg_errno() should yield a short error string
> without newlines.
> 
> Here, we try to append additional help to the error message by
> embedding newlines in the error string.  That's nice, but it's doesn't
> play nicely with the errno part.  tests/qemu-iotests/070.out shows the
> resulting mess:
> 
>     can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 
> 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log 
> that needs to be replayed.  To replay the log, execute:
>      qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx': Operation 
> not permitted
> 
> Switch to error_setg() and error_append_hint().  Result:
> 
>     can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 
> 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log 
> that needs to be replayed
>     To replay the log, run:
>     qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx'

The loss of the strerror() text isn't too bad; particularly since it is
probably always going to be 'Operation not permitted' and redundant with
the text about being read-only with a replay that requires write access.

> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  block/vhdx-log.c           | 13 +++++++------
>  tests/qemu-iotests/070.out |  5 +++--
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to