diff options
author | Lukas Larsson <[email protected]> | 2014-11-05 15:16:35 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-11-05 15:16:35 +0100 |
commit | 965187787f603181aadbe5effdbb8fa6dc90b9ac (patch) | |
tree | 1db4e50f0dd8ca32ddfab3e39d70776b9b241329 /erts/emulator | |
parent | 509163307c31bf4f98a638b47ee03a5b99eb2c73 (diff) | |
parent | a5bfb0a58783c472887ce0ad2060e4a395aa941d (diff) | |
download | otp-965187787f603181aadbe5effdbb8fa6dc90b9ac.tar.gz otp-965187787f603181aadbe5effdbb8fa6dc90b9ac.tar.bz2 otp-965187787f603181aadbe5effdbb8fa6dc90b9ac.zip |
Merge branch 'lukas/erts/fdopen_non_bound_win32_fix/OTP-12289' into maint
* lukas/erts/fdopen_non_bound_win32_fix/OTP-12289:
erts: getsockname is not allowed on non-bound sockets
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 12 |
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 */ |