diff options
Diffstat (limited to 'lib/kernel/src/gen_tcp.erl')
-rw-r--r-- | lib/kernel/src/gen_tcp.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl index 26afed4ff9..3f1e432f7a 100644 --- a/lib/kernel/src/gen_tcp.erl +++ b/lib/kernel/src/gen_tcp.erl @@ -420,15 +420,16 @@ mod([], Address) -> sendfile(#file_descriptor{ module = Mod } = Fd, Sock, Offset, Bytes, ChunkSize, Headers, Trailers, Nodiskio, MNowait, Sync) when is_port(Sock) -> - {ok,SockFd} = prim_inet:stealfd(Sock), + ok = prim_inet:ignorefd(Sock,true), + {ok, SockFd} = prim_inet:getfd(Sock), case Mod:sendfile(Fd, SockFd, Offset, Bytes, ChunkSize, Headers, Trailers, Nodiskio, MNowait, Sync) of {error, enotsup} -> - prim_inet:returnfd(Sock), + ok = prim_inet:ignorefd(Sock,false), sendfile_fallback(Fd, Sock, Offset, Bytes, ChunkSize, Headers, Trailers); Else -> - prim_inet:returnfd(Sock), + ok = prim_inet:ignorefd(Sock,false), Else end; sendfile(_,_,_,_,_,_,_,_,_,_) -> |