Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2009 18:44:56 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192204 - head/sys/compat/linux
Message-ID:  <200905161844.n4GIiu4X066710@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905161844.n4GIiu4X066710>