qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] qemu-sockets: Add error to non-blocking con


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/2] qemu-sockets: Add error to non-blocking connect handler
Date: Wed, 08 Oct 2014 00:15:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

Il 06/10/2014 19:59, address@hidden ha scritto:
> +        error_setg_errno(&err, errno, "Error connecting to socket");
>          closesocket(s->fd);
>          s->fd = rc;
>      }
> @@ -257,9 +259,14 @@ static void wait_for_connect(void *opaque)
>          while (s->current_addr->ai_next != NULL && s->fd < 0) {
>              s->current_addr = s->current_addr->ai_next;
>              s->fd = inet_connect_addr(s->current_addr, &in_progress, s, 
> NULL);
> +            if (s->fd < 0) {
> +                error_free(err);
> +                err = NULL;
> +                error_setg_errno(&err, errno, "Unable to start socket 
> connect");

So the above snippet is the actual errors that are passed here:

> +static void check_report_connect_error(CharDriverState *chr, const char *str,
> +                                       Error *err)
>  {
>      TCPCharDriver *s = chr->opaque;
>  
>      if (!s->connect_err_reported) {
> -        error_report("%s char device %s\n", str, chr->label);
> +        error_report("%s char device %s: %s\n", str, chr->label,
> +                     error_get_pretty(err));


If you just make it

error_report("%s: %s", chr->label, error_get_pretty(err));

we still get a good error.  It would arguably be better, since there's
no duplication, except that it doesn't mention character devices
anymore.  But something like "serial0: error connecting to socket" is a
decent error.

Thanks,

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]