summaryrefslogtreecommitdiff
path: root/lib/kernel
diff options
context:
space:
mode:
authorŁukasz Niemier <lukasz@niemier.pl>2021-05-03 09:55:07 +0200
committerŁukasz Niemier <lukasz@niemier.pl>2021-05-03 09:55:07 +0200
commitdd29abe73837abf153e1536b8745365e9c3b8dd8 (patch)
tree07a69d0bf56727a4f0d163e379359ed559391c75 /lib/kernel
parent1f65b3cd1bfcb7d0749cbbc42030125d47281dbe (diff)
downloaderlang-dd29abe73837abf153e1536b8745365e9c3b8dd8.tar.gz
fix: use better check for passed FD
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/gen_tcp_socket.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/kernel/src/gen_tcp_socket.erl b/lib/kernel/src/gen_tcp_socket.erl
index 59fc172ea9..7c1ef4ed5b 100644
--- a/lib/kernel/src/gen_tcp_socket.erl
+++ b/lib/kernel/src/gen_tcp_socket.erl
@@ -165,8 +165,8 @@ connect_open(Addrs, Domain, ConnectOpts, Opts, Fd, Timer, BindAddr) ->
try
ok(ErrRef, call(Server, {setopts, SocketOpts ++ Setopts})),
if
- not is_integer(Fd) -> ok(ErrRef, call_bind(Server, BindAddr));
- true -> ok
+ is_map_key(fd, ExtraOpts) -> ok;
+ true -> ok(ErrRef, call_bind(Server, BindAddr))
end,
DefaultError = {error, einval},
Socket =
@@ -298,8 +298,8 @@ listen_open(Domain, ListenOpts, Opts, Fd, Backlog, BindAddr) ->
{setopts,
[{start_opts, StartOpts}] ++ SocketOpts ++ Setopts})),
if
- not is_integer(Fd) -> ok(ErrRef, call_bind(Server, BindAddr));
- true -> ok
+ is_map_key(fd, ExtraOpts) -> ok;
+ true -> ok(ErrRef, call_bind(Server, BindAddr))
end,
Socket = val(ErrRef, call(Server, {listen, Backlog})),
{ok, ?MODULE_socket(Server, Socket)}