On 07/23/2015 08:01 AM, Markus Armbruster wrote:
> Duplicated when commit 680d16d added error_set_errno(), and again when
> commit 20840d4 added error_set_win32().
> 
> Make the original copy in error_set() reusable by factoring out
> error_setv(), then rewrite error_set_errno() and error_set_win32() on
> top of it.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> Reviewed-by: Eric Blake <ebl...@redhat.com>
> ---
>  util/error.c | 70 
> ++++++++++++++++++++++--------------------------------------
>  1 file changed, 26 insertions(+), 44 deletions(-)
> 

>      if (os_errno != 0) {
> -        err->msg = g_strdup_printf("%s: %s", msg1, strerror(os_errno));
> -        g_free(msg1);
> -    } else {
> -        err->msg = msg1;
> +        msg = (*errp)->msg;
> +        (*errp)->msg = g_strdup_printf("%s: %s", msg, strerror(os_errno));

Unrelated comment, so doesn't change R-b:

strerror() is not required to be thread-safe, and can return NULL on
error.  Do we care?

-- 
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