summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_socket.c
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2009-05-07 03:23:22 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2009-05-07 03:23:22 +0000
commit1a52a4abf7af9e7cc74b04b4ca5ce6d71a3d671c (patch)
tree785a91aae2ba245bb87905df48ddf5d4fe932f96 /sys/compat/linux/linux_socket.c
parent426909d9694cda33a247ea244a95d947773657df (diff)
Notes
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r--sys/compat/linux/linux_socket.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index c92fd127e822..91a1a46f6761 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -855,14 +855,21 @@ linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
} */ bsd_args;
bsd_args.domain = linux_to_bsd_domain(args->domain);
- if (bsd_args.domain == -1)
- return (EINVAL);
+ if (bsd_args.domain != PF_LOCAL)
+ return (EAFNOSUPPORT);
bsd_args.type = args->type;
- if (bsd_args.domain == AF_LOCAL && args->protocol == PF_UNIX)
- bsd_args.protocol = 0;
+ if (args->protocol != 0 && args->protocol != PF_UNIX)
+
+ /*
+ * Use of PF_UNIX as protocol argument is not right,
+ * but Linux does it.
+ * Do not map PF_UNIX as its Linux value is identical
+ * to FreeBSD one.
+ */
+ return (EPROTONOSUPPORT);
else
- bsd_args.protocol = args->protocol;
+ bsd_args.protocol = 0;
bsd_args.rsv = (int *)PTRIN(args->rsv);
return (socketpair(td, &bsd_args));
}