From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:44:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD02106566C; Sat, 16 May 2009 18:44:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA00A8FC1E; Sat, 16 May 2009 18:44:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GIiuwW066711; Sat, 16 May 2009 18:44:56 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GIiu4X066710; Sat, 16 May 2009 18:44:56 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905161844.n4GIiu4X066710@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 May 2009 18:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192204 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:44:57 -0000 Author: dchagin Date: Sat May 16 18:44:56 2009 New Revision: 192204 URL: http://svn.freebsd.org/changeset/base/192204 Log: Use the protocol family constants for the domain argument validation. Return immediately when the socket() failed. Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat May 16 18:42:18 2009 (r192203) +++ head/sys/compat/linux/linux_socket.c Sat May 16 18:44:56 2009 (r192204) @@ -602,10 +602,12 @@ linux_socket(struct thread *td, struct l return (EAFNOSUPPORT); retval_socket = socket(td, &bsd_args); + if (retval_socket) + return (retval_socket); + if (bsd_args.type == SOCK_RAW && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0) - && bsd_args.domain == AF_INET - && retval_socket >= 0) { + && bsd_args.domain == PF_INET) { /* It's a raw IP socket: set the IP_HDRINCL option. */ int hdrincl; @@ -620,7 +622,7 @@ linux_socket(struct thread *td, struct l * default and some apps depend on this. So, set V6ONLY to 0 * for Linux apps if the sysctl value is set to 1. */ - if (bsd_args.domain == PF_INET6 && retval_socket >= 0 + if (bsd_args.domain == PF_INET6 #ifndef KLD_MODULE /* * XXX: Avoid undefined symbol error with an IPv4 only