diff options
author | dchagin <dchagin@FreeBSD.org> | 2009-05-16 18:44:56 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2009-05-16 18:44:56 +0000 |
commit | eae11e9cce32ec5994ed146a89e03c915d86051e (patch) | |
tree | a696c0ff573fda52b07dbce27dcf15940352e0b4 /sys/compat/linux/linux_socket.c | |
parent | bc4e3c1f6d89b977ecd4d226f0cd88dccd1e70a9 (diff) | |
download | FreeBSD-src-eae11e9cce32ec5994ed146a89e03c915d86051e.zip FreeBSD-src-eae11e9cce32ec5994ed146a89e03c915d86051e.tar.gz |
Use the protocol family constants for the domain argument validation.
Return immediately when the socket() failed.
Approved by: kib (mentor)
MFC after: 1 month
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r-- | sys/compat/linux/linux_socket.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index da7d829..ee7bf18 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -602,10 +602,12 @@ linux_socket(struct thread *td, struct linux_socket_args *args) 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 linux_socket_args *args) * 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 |