svn commit: r192204 - head/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Sat May 16 18:44:57 UTC 2009


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


More information about the svn-src-head mailing list