diff options
author | Ingela Anderton Andin <[email protected]> | 2016-10-05 15:15:35 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2016-10-05 15:55:21 +0200 |
commit | abf7b8c8397acaa9bee0ccf284b1af4e130c16af (patch) | |
tree | f46a42fa5bf5e2d8d86e41cec4f06ecf453bf500 /lib | |
parent | 310b00b7fc18b5883f5f2cb1b992deb1dd6c9a65 (diff) | |
download | otp-abf7b8c8397acaa9bee0ccf284b1af4e130c16af.tar.gz otp-abf7b8c8397acaa9bee0ccf284b1af4e130c16af.tar.bz2 otp-abf7b8c8397acaa9bee0ccf284b1af4e130c16af.zip |
ssh: Handle gen_server:call/3 exits properly
Handle all possible exit values that should be interpreted as {error,
closed}. Failing to do so could lead to unexpected crashes for users
of the ssh application.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssh/src/ssh_channel.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_channel.erl b/lib/ssh/src/ssh_channel.erl index a8e6ebde16..426e2f5125 100644 --- a/lib/ssh/src/ssh_channel.erl +++ b/lib/ssh/src/ssh_channel.erl @@ -93,11 +93,16 @@ call(ChannelPid, Msg, TimeOute) -> catch exit:{noproc, _} -> {error, closed}; + exit:{normal, _} -> + {error, closed}; + exit:{shutdown, _} -> + {error, closed}; + exit:{{shutdown, _}, _} -> + {error, closed}; exit:{timeout, _} -> {error, timeout} end. - cast(ChannelPid, Msg) -> gen_server:cast(ChannelPid, Msg). |