From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xbd3b-0001Ij-A1 for qemu-devel@nongnu.org; Tue, 07 Oct 2014 18:16:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xbd3U-0004H8-87 for qemu-devel@nongnu.org; Tue, 07 Oct 2014 18:16:35 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:32801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xbd3U-0004Gu-4F for qemu-devel@nongnu.org; Tue, 07 Oct 2014 18:16:28 -0400 Received: by mail-qc0-f174.google.com with SMTP id m20so6648142qcx.33 for ; Tue, 07 Oct 2014 15:15:41 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54346608.7040509@redhat.com> Date: Wed, 08 Oct 2014 00:15:36 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1412618363-14968-1-git-send-email-minyard@acm.org> <1412618363-14968-3-git-send-email-minyard@acm.org> In-Reply-To: <1412618363-14968-3-git-send-email-minyard@acm.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 2/2] qemu-sockets: Add error to non-blocking connect handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: minyard@acm.org, qemu-devel@nongnu.org Cc: Corey Minyard Il 06/10/2014 19:59, minyard@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