diff options
author | Lukas Larsson <[email protected]> | 2012-05-23 11:23:54 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2012-05-23 11:23:54 +0200 |
commit | 1ba2039020738673b3913be0e48d83713503a3b7 (patch) | |
tree | e62d160f353b94e076fdbec2834361034bd7318c /lib/kernel/src/inet.erl | |
parent | e4717301b73f2d7b2716b625e1b647b35d2815be (diff) | |
parent | 3e5015a959c9533582b0e4a027158ea8252f7c31 (diff) | |
download | otp-1ba2039020738673b3913be0e48d83713503a3b7.tar.gz otp-1ba2039020738673b3913be0e48d83713503a3b7.tar.bz2 otp-1ba2039020738673b3913be0e48d83713503a3b7.zip |
Merge branch 'lukas/kernel/fix-gen_udp_tcp-leak/OTP-10094' into maint
* lukas/kernel/fix-gen_udp_tcp-leak/OTP-10094:
Add testcase for controlling_process(P,self())
Fix port leaking after controlling_process(Port, self())
Diffstat (limited to 'lib/kernel/src/inet.erl')
-rw-r--r-- | lib/kernel/src/inet.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl index abaf4486dc..0bb5444dbb 100644 --- a/lib/kernel/src/inet.erl +++ b/lib/kernel/src/inet.erl @@ -1246,6 +1246,8 @@ udp_close(S) when is_port(S) -> %% Set controlling process for TCP socket. tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) -> case erlang:port_info(S, connected) of + {connected, NewOwner} -> + ok; {connected, Pid} when Pid =/= self() -> {error, not_owner}; undefined -> @@ -1297,6 +1299,8 @@ tcp_sync_input(S, Owner, Flag) -> %% Set controlling process for UDP or SCTP socket. udp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) -> case erlang:port_info(S, connected) of + {connected, NewOwner} -> + ok; {connected, Pid} when Pid =/= self() -> {error, not_owner}; _ -> |