diff options
author | Ingela Anderton Andin <[email protected]> | 2015-04-08 20:07:34 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-04-14 09:07:25 +0200 |
commit | fee64d33a788bf6e32a53e1d665c498c86004980 (patch) | |
tree | ae8c52fdefe8d83311ee6411fe31ec0c52dbc423 /lib/ssh/src/ssh_sftp.erl | |
parent | d6ce7b7c14be17c2184878b0bae3f2715bb45358 (diff) | |
download | otp-fee64d33a788bf6e32a53e1d665c498c86004980.tar.gz otp-fee64d33a788bf6e32a53e1d665c498c86004980.tar.bz2 otp-fee64d33a788bf6e32a53e1d665c498c86004980.zip |
ssh: Shutdown sftp channel gracefully
If ssh_connection:subsystem/4 fails we do not want to crash but rather
terminate gracefully.
Diffstat (limited to 'lib/ssh/src/ssh_sftp.erl')
-rw-r--r-- | lib/ssh/src/ssh_sftp.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl index 613f8f25b2..c264eabc78 100644 --- a/lib/ssh/src/ssh_sftp.erl +++ b/lib/ssh/src/ssh_sftp.erl @@ -111,7 +111,7 @@ start_channel(Cm, Opts) when is_pid(Cm) -> TimeOut end; {error, Reason} -> - {error, Reason}; + {error, format_channel_start_error(Reason)}; ignore -> {error, ignore} end; @@ -136,7 +136,7 @@ start_channel(Host, Port, Opts) -> TimeOut end; {error, Reason} -> - {error, Reason}; + {error, format_channel_start_error(Reason)}; ignore -> {error, ignore} end; @@ -491,9 +491,9 @@ init([Cm, ChannelId, Options]) -> inf = new_inf(), opts = Options}}; failure -> - {stop, "server failed to start sftp subsystem"}; + {stop, {shutdown, "server failed to start sftp subsystem"}}; Error -> - {stop, Error} + {stop, {shutdown, Error}} end. %%-------------------------------------------------------------------- @@ -1412,3 +1412,8 @@ open_buf1(Pid, BufInfo0, FileOpTimeout, CryptoState, ChunkSize) -> BufHandle = make_ref(), call(Pid, {put_bufinf,BufHandle,BufInfo}, FileOpTimeout), {ok,BufHandle}. + +format_channel_start_error({shutdown, Reason}) -> + Reason; +format_channel_start_error(Reason) -> + Reason. |