diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2005-07-09 12:26:22 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2005-07-09 12:26:22 +0000 |
| commit | 4641373fded7dfd64f93f45371e42a3ea6e82559 (patch) | |
| tree | 95ebffd3322d517c3c43f6c216357b9bb934d16e /sys/compat/linux/linux_socket.c | |
| parent | 542d484d7f18e94558e87f1e13d043503ba606f5 (diff) | |
Notes
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
| -rw-r--r-- | sys/compat/linux/linux_socket.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 950e170bf459..f1f26bcf9686 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -44,7 +44,9 @@ __FBSDID("$FreeBSD$"); #include <sys/fcntl.h> #include <sys/file.h> #include <sys/limits.h> +#include <sys/lock.h> #include <sys/malloc.h> +#include <sys/mutex.h> #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/socketvar.h> @@ -614,15 +616,20 @@ linux_connect(struct thread *td, struct linux_connect_args *args) * when on a non-blocking socket. Instead it returns the * error getsockopt(SOL_SOCKET, SO_ERROR) would return on BSD. */ - if ((error = fgetsock(td, linux_args.s, &so, &fflag)) != 0) - return(error); - error = EISCONN; - if (fflag & FNONBLOCK) { - if (so->so_emuldata == 0) - error = so->so_error; - so->so_emuldata = (void *)1; + NET_LOCK_GIANT(); + error = fgetsock(td, linux_args.s, &so, &fflag); + if (error == 0) { + error = EISCONN; + if (fflag & FNONBLOCK) { + SOCK_LOCK(so); + if (so->so_emuldata == 0) + error = so->so_error; + so->so_emuldata = (void *)1; + SOCK_UNLOCK(so); + } + fputsock(so); } - fputsock(so); + NET_UNLOCK_GIANT(); return (error); } |
