From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G1KMP-0000zS-QI for qemu-devel@nongnu.org; Fri, 14 Jul 2006 05:53:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G1KMP-0000yz-3V for qemu-devel@nongnu.org; Fri, 14 Jul 2006 05:53:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G1KMO-0000yu-SA for qemu-devel@nongnu.org; Fri, 14 Jul 2006 05:53:24 -0400 Received: from [84.96.92.56] (helo=smTp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G1KOL-0003sX-W2 for qemu-devel@nongnu.org; Fri, 14 Jul 2006 05:55:26 -0400 Received: from [84.102.211.169] by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0J2E00F220SZIGB0@sp604003mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Fri, 14 Jul 2006 11:53:23 +0200 (CEST) Date: Fri, 14 Jul 2006 11:53:21 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] Fix for accept In-reply-to: <44B74C5A.6000408@nomovok.com> Message-id: <44B76991.6030106@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <44B61EBE.1090907@nomovok.com> <44B6AFB5.1080403@bellard.org> <44B74C5A.6000408@nomovok.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Pablo Virolainen wrote: > So I should write something like following instead? > > if (!get_user(addrlen,&target_addrlen)) { > return -EFAULT > } Yes. > The code seems to assume target_sockaddr == sockaddr, so why allocate > temporary buffer and then do copying? If the assumption "target_sockaddr == sockaddr" is made, then it is a bug. > One could implement SOCKOP_[accept|getsockname|getpeername] with same > code. > [...] You can use common code, but I think it is clearer to have the do_accept, do_getsockname and do_getpeername helpers. Fabrice.