Il 06/10/2014 19:59, miny...@acm.org 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