From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBEL-0004JW-Ud for qemu-devel@nongnu.org; Fri, 15 May 2015 04:44:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtBEF-0004Rz-Mh for qemu-devel@nongnu.org; Fri, 15 May 2015 04:44:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBEF-0004Rv-Gr for qemu-devel@nongnu.org; Fri, 15 May 2015 04:44:23 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 271518F003 for ; Fri, 15 May 2015 08:44:23 +0000 (UTC) From: Markus Armbruster References: <1431432187-10993-1-git-send-email-armbru@redhat.com> <1431432187-10993-13-git-send-email-armbru@redhat.com> <555519EE.1090301@redhat.com> Date: Fri, 15 May 2015 10:44:20 +0200 In-Reply-To: <555519EE.1090301@redhat.com> (Eric Blake's message of "Thu, 14 May 2015 15:55:58 -0600") Message-ID: <87382ynsbf.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 12/15] tap-bsd: Convert tap_open() to Error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, stefanha@redhat.com Eric Blake writes: > On 05/12/2015 06:03 AM, Markus Armbruster wrote: >> Fixes inappropriate use of stderr in monitor command handler. >> >> While there, improve some of the messages a bit. >> >> Signed-off-by: Markus Armbruster >> --- >> net/tap-bsd.c | 33 ++++++++++++++------------------- >> 1 file changed, 14 insertions(+), 19 deletions(-) >> > >> @@ -139,14 +133,15 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, >> /* User requested the interface to have a specific name */ >> s = socket(AF_LOCAL, SOCK_DGRAM, 0); >> if (s < 0) { >> - error_report("could not open socket to set interface name"); >> + error_setg_errno(errp, errno, >> + "could not open socket to set interface name"); >> goto error; >> } >> ifr.ifr_data = ifname; >> ret = ioctl(s, SIOCSIFNAME, (void *)&ifr); >> close(s); >> if (ret < 0) { >> - error_report("could not set tap interface name"); >> + error_setg_errno(errp, errno, "could not set tap interface name"); > > Bad. close() may have clobbered errno before you get to report it. You're right. I'll dumb this down again. >> goto error; >> } >> } else { >> @@ -158,14 +153,14 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, >> *vnet_hdr = 0; >> >> if (vnet_hdr_required && !*vnet_hdr) { >> - error_report("vnet_hdr=1 requested, but no kernel " >> - "support for IFF_VNET_HDR available"); >> + error_setg(errp, "vnet_hdr=1 requested, but no kernel " >> + "support for IFF_VNET_HDR available"); >> goto error; >> } >> } >> if (mq_required) { >> - error_report("mq_required requested, but not kernel support" >> - "for IFF_MULTI_QUEUE available"); >> + error_setg(errp, "mq_required requested, but not kernel support" > > As long as you are touching this, s/not/no/ Fixing... >> + "for IFF_MULTI_QUEUE available"); >> goto error; >> }