From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Wolf Subject: Re: [Qemu-devel] [PATCH v3 1/9] net: introduce tcp_server_start() Date: Wed, 14 Mar 2012 12:39:47 +0100 Message-ID: <4F608383.5060908@redhat.com> References: <20120306224330.24264.9494.stgit@dhcp-8-167.nay.redhat.com> <20120306224745.24264.19990.stgit@dhcp-8-167.nay.redhat.com> <4F60455C.7090406@redhat.com> <4F60485D.9050209@redhat.com> <4F604DE5.1050101@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, Orit Wasserman , laine@redhat.com To: Amos Kong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6186 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755421Ab2CNLgV (ORCPT ); Wed, 14 Mar 2012 07:36:21 -0400 In-Reply-To: <4F604DE5.1050101@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Am 14.03.2012 08:51, schrieb Amos Kong: > On 14/03/12 15:27, Paolo Bonzini wrote: >> > > Hi Paolo, > >> Il 14/03/2012 08:14, Orit Wasserman ha scritto: >>> if (bind(*fd, (struct sockaddr *)&saddr, sizeof(saddr))< 0) >>> { >>> closesocket(*fd); >>> return -socket_error(); >>> } >>> return 0; >>> >>> and than you will not need ret >> >> But closesocket could clobber socket_error(), no? > > Yes, it will effect socket_error() > > How about this fix ? > > ret = bind(*fd, (struct sockaddr *)&saddr, sizeof(saddr)); > if (ret < 0) { > ret = -socket_error(); > closesocket(*fd); > } > return ret; > } > But it's still moved (or in this patch copied) code, right? If so, please move it in one patch, and then fix it in another one on top. Kevin From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7mVH-0007rW-G2 for qemu-devel@nongnu.org; Wed, 14 Mar 2012 07:36:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7mV9-0004Lk-4q for qemu-devel@nongnu.org; Wed, 14 Mar 2012 07:36:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7mV8-0004Le-T1 for qemu-devel@nongnu.org; Wed, 14 Mar 2012 07:36:19 -0400 Message-ID: <4F608383.5060908@redhat.com> Date: Wed, 14 Mar 2012 12:39:47 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <20120306224330.24264.9494.stgit@dhcp-8-167.nay.redhat.com> <20120306224745.24264.19990.stgit@dhcp-8-167.nay.redhat.com> <4F60455C.7090406@redhat.com> <4F60485D.9050209@redhat.com> <4F604DE5.1050101@redhat.com> In-Reply-To: <4F604DE5.1050101@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 1/9] net: introduce tcp_server_start() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, Orit Wasserman , laine@redhat.com, Paolo Bonzini Am 14.03.2012 08:51, schrieb Amos Kong: > On 14/03/12 15:27, Paolo Bonzini wrote: >> > > Hi Paolo, > >> Il 14/03/2012 08:14, Orit Wasserman ha scritto: >>> if (bind(*fd, (struct sockaddr *)&saddr, sizeof(saddr))< 0) >>> { >>> closesocket(*fd); >>> return -socket_error(); >>> } >>> return 0; >>> >>> and than you will not need ret >> >> But closesocket could clobber socket_error(), no? > > Yes, it will effect socket_error() > > How about this fix ? > > ret = bind(*fd, (struct sockaddr *)&saddr, sizeof(saddr)); > if (ret < 0) { > ret = -socket_error(); > closesocket(*fd); > } > return ret; > } > But it's still moved (or in this patch copied) code, right? If so, please move it in one patch, and then fix it in another one on top. Kevin