diff options
author | Henrik Nord <[email protected]> | 2011-08-08 15:40:14 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-08-08 15:40:18 +0200 |
commit | b74afd6bcf54d3bc6a51da30a7551b3b2a0f402b (patch) | |
tree | a43c4b577f4203fbdf1b9805e5b8d5692d428a32 /erts/emulator/drivers/common | |
parent | 49f599b10882c7dc779d5b2bc06c4462f50209d1 (diff) | |
parent | 169080db01101a4db6b1c265d04d972f3c39488a (diff) | |
download | otp-b74afd6bcf54d3bc6a51da30a7551b3b2a0f402b.tar.gz otp-b74afd6bcf54d3bc6a51da30a7551b3b2a0f402b.tar.bz2 otp-b74afd6bcf54d3bc6a51da30a7551b3b2a0f402b.zip |
Merge branch 'ms/inet-socket-domain-error' into dev
* ms/inet-socket-domain-error:
inet: error if fd does not match socket domain
OTP-9455
Diffstat (limited to 'erts/emulator/drivers/common')
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 40c4a0df08..ebc4469a23 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -3709,6 +3709,8 @@ static int inet_ctl_fdopen(inet_descriptor* desc, int domain, int type, /* check that it is a socket and that the socket is bound */ if (IS_SOCKET_ERROR(sock_name(s, (struct sockaddr*) &name, &sz))) return ctl_error(sock_errno(), rbuf, rsize); + if (name.sa.sa_family != domain) + return ctl_error(EINVAL, rbuf, rsize); desc->s = s; if ((desc->event = sock_create_event(desc)) == INVALID_EVENT) return ctl_error(sock_errno(), rbuf, rsize); @@ -9739,7 +9741,7 @@ static int packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len, if (desc->active || (len != 8)) return ctl_error(EINVAL, rbuf, rsize); timeout = get_int32(buf); - /* The 2nd arg, Length(4), is ignored for both UDP ans SCTP protocols, + /* The 2nd arg, Length(4), is ignored for both UDP and SCTP protocols, since they are msg-oriented. */ if (enq_async(desc, tbuf, PACKET_REQ_RECV) < 0) |