summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_socket.c
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2006-09-23 19:06:54 +0000
committernetchild <netchild@FreeBSD.org>2006-09-23 19:06:54 +0000
commit6ecb474f4fee36803a21cadcee5dc0f6b0e6b4d2 (patch)
tree7a35442ca35fbab402321b222ccf332ac2aa2150 /sys/compat/linux/linux_socket.c
parent39ac06be39bc2d3437458d0d947516526772cffb (diff)
downloadFreeBSD-src-6ecb474f4fee36803a21cadcee5dc0f6b0e6b4d2.zip
FreeBSD-src-6ecb474f4fee36803a21cadcee5dc0f6b0e6b4d2.tar.gz
MFp4:
- Linux returns ENOPROTOOPT in a case of not supported opt to setsockopt. - Return EISDIR in pread() when arg is a directory. - Return EINVAL instead of EFAULT when namelen is not correct in accept(). - Return EINVAL instead of EACCESS if invalid access mode is entered in access(). - Return EINVAL instead of EADDRNOTAVAIL in a case of bad salen param to bind(). Submitted by: rdivacky Tested with: LTP (vfork01 fails now, but it seems to be a race and not caused by those changes) MFC after: 1 week
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r--sys/compat/linux/linux_socket.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 3f089c0..174fba6 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -611,6 +611,8 @@ linux_bind(struct thread *td, struct linux_bind_args *args)
error = kern_bind(td, linux_args.s, sa);
free(sa, M_SONAME);
+ if (error == EADDRNOTAVAIL && linux_args.namelen != sizeof(struct sockaddr_in))
+ return (EINVAL);
return (error);
}
@@ -719,8 +721,11 @@ linux_accept(struct thread *td, struct linux_accept_args *args)
bsd_args.anamelen = PTRIN(linux_args.namelen);/* XXX */
error = accept(td, &bsd_args);
bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name);
- if (error)
+ if (error) {
+ if (error == EFAULT && linux_args.namelen != sizeof(struct sockaddr_in))
+ return (EINVAL);
return (error);
+ }
if (linux_args.addr) {
error = linux_sa_put(PTRIN(linux_args.addr));
if (error) {
@@ -1135,7 +1140,7 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
break;
}
if (name == -1)
- return (EINVAL);
+ return (ENOPROTOOPT);
bsd_args.name = name;
bsd_args.val = PTRIN(linux_args.optval);
OpenPOWER on IntegriCloud