summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r--sys/compat/linux/linux_socket.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index c19167a..6df0ce7 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -838,7 +838,10 @@ linux_accept_common(struct thread *td, int s, l_uintptr_t addr,
socklen_t * __restrict anamelen;
int flags;
} */ bsd_args;
- int error;
+ cap_rights_t rights;
+ struct socket *so;
+ struct file *fp;
+ int error, error1;
bsd_args.s = s;
/* XXX: */
@@ -853,6 +856,17 @@ linux_accept_common(struct thread *td, int s, l_uintptr_t addr,
if (error) {
if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
return (EINVAL);
+ if (error == EINVAL) {
+ error1 = getsock_cap(td, s, &rights, &fp, NULL);
+ if (error1 != 0)
+ return (error1);
+ so = fp->f_data;
+ if (so->so_type == SOCK_DGRAM) {
+ fdrop(fp, td);
+ return (EOPNOTSUPP);
+ }
+ fdrop(fp, td);
+ }
return (error);
}
if (addr)
OpenPOWER on IntegriCloud