On 06/15/2016 09:36 AM, Max Reitz wrote:
> Emitting the plain error number is not very helpful. Use strerror()
> instead.
> 
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  qemu-img.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 14e2661..d5ccd9a 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3277,7 +3277,7 @@ static int img_resize(int argc, char **argv)
>          error_report("Image is read-only");
>          break;
>      default:
> -        error_report("Error resizing image (%d)", -ret);
> +        error_report("Error resizing image: %s", strerror(-ret));
>          break;

I've argued in the past that we have lots of error_report() callers
using strerror(), and may want to add an error_report_errno() (similar
to error_setg_errno()); this just adds to the list of things that would
benefit.  But such a conversion would be a separate BiteSized task, and
doesn't invalidate your patch.

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