diff options
author | Kostis Sagonas <[email protected]> | 2016-10-21 22:04:29 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2016-10-21 22:04:29 +0200 |
commit | 96659515747469152efad13819ddb55be2a76f6d (patch) | |
tree | 4a8797addd7b4a6e1e6ed115c63c225435420830 | |
parent | 5693b4cddd9a855a3277dc3aa51f22a2f768fe4a (diff) | |
download | otp-96659515747469152efad13819ddb55be2a76f6d.tar.gz otp-96659515747469152efad13819ddb55be2a76f6d.tar.bz2 otp-96659515747469152efad13819ddb55be2a76f6d.zip |
Change two calls to file_close/1 to allow {error,einval}
-rw-r--r-- | lib/inets/src/ftp/ftp.erl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl index d4959238e1..911f5b71a7 100644 --- a/lib/inets/src/ftp/ftp.erl +++ b/lib/inets/src/ftp/ftp.erl @@ -1475,16 +1475,19 @@ handle_info({Trpt, Socket, Data}, #state{dsock = {Trpt,Socket}} = State0) when T Data/binary>>}}; handle_info({Cls, Socket}, #state{dsock = {Trpt,Socket}, - caller = {recv_file, Fd}} - = State) when {Cls,Trpt}=={tcp_closed,tcp} ; {Cls,Trpt}=={ssl_closed,ssl} -> - ok = file_close(Fd), + caller = {recv_file, Fd}} = State) + when {Cls,Trpt}=={tcp_closed,tcp} ; {Cls,Trpt}=={ssl_closed,ssl} -> + case file_close(Fd) of + ok -> ok; + {error,einval} -> ok + end, progress_report({transfer_size, 0}, State), activate_ctrl_connection(State), {noreply, State#state{dsock = undefined, data = <<>>}}; handle_info({Cls, Socket}, #state{dsock = {Trpt,Socket}, client = From, - caller = recv_chunk} - = State) when {Cls,Trpt}=={tcp_closed,tcp} ; {Cls,Trpt}=={ssl_closed,ssl} -> + caller = recv_chunk} = State) + when {Cls,Trpt}=={tcp_closed,tcp} ; {Cls,Trpt}=={ssl_closed,ssl} -> gen_server:reply(From, ok), {noreply, State#state{dsock = undefined, client = undefined, data = <<>>, caller = undefined, @@ -2063,7 +2066,10 @@ handle_ctrl_result({pos_prel, _}, #state{caller = {recv_file, _}} = State0) -> end; handle_ctrl_result({Status, _}, #state{caller = {recv_file, Fd}} = State) -> - ok = file_close(Fd), + case file_close(Fd) of + ok -> ok; + {error, einval} -> ok + end, close_data_connection(State), ctrl_result_response(Status, State#state{dsock = undefined}, {error, epath}); |