aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-11-05 15:16:42 +0100
committerLukas Larsson <[email protected]>2014-11-05 15:16:42 +0100
commit0c23d76c650e3dca4935aaca2f2ea88b0e9a52ff (patch)
treef74d8c62fa530b3c5cf50f480a35b83b5c7ee5a1 /erts/emulator
parent7ed6eb5554bdf84da4549c9e6d38f85d8b397d33 (diff)
parent965187787f603181aadbe5effdbb8fa6dc90b9ac (diff)
downloadotp-0c23d76c650e3dca4935aaca2f2ea88b0e9a52ff.tar.gz
otp-0c23d76c650e3dca4935aaca2f2ea88b0e9a52ff.tar.bz2
otp-0c23d76c650e3dca4935aaca2f2ea88b0e9a52ff.zip
Merge branch 'maint'
* maint: erts: getsockname is not allowed on non-bound sockets
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 891589d1c5..db8a251fdd 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -4542,11 +4542,13 @@ static ErlDrvSSizeT inet_ctl_fdopen(inet_descriptor* desc, int domain, int type,
inet_address name;
unsigned int sz = sizeof(name);
- /* 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);
+ if (bound) {
+ /* 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);
+ }
#ifdef __OSE__
/* for fdopen duplicating the sd will allow to uniquely identify
the signal from OSE with erlang port */