aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_sftp.erl
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2011-08-23 15:26:10 +0200
committerNiclas Eklund <[email protected]>2011-08-23 15:26:10 +0200
commitda62065765d3512afa793d64cdc96b6995526424 (patch)
tree736a646bcf20b65e9f3b65c221598025b5e07faf /lib/ssh/src/ssh_sftp.erl
parent6d698a28ecde4bfc2b4e749d7db2af2f48fc29f1 (diff)
parentb43386bc392859251fabc20c3ba12e275342333d (diff)
downloadotp-da62065765d3512afa793d64cdc96b6995526424.tar.gz
otp-da62065765d3512afa793d64cdc96b6995526424.tar.bz2
otp-da62065765d3512afa793d64cdc96b6995526424.zip
Merge branch 'nick/ssh/stop_channel_tampers_with_trap_exit_flag/OTP-9386' into dev
* nick/ssh/stop_channel_tampers_with_trap_exit_flag/OTP-9386: Corrected year in license header. OTP-9386 - Calling ssh_sftp:stop_channel/1 resulted in that the trap_exit flag was set to true for the invoking process.
Diffstat (limited to 'lib/ssh/src/ssh_sftp.erl')
-rwxr-xr-xlib/ssh/src/ssh_sftp.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl
index 59e09fdd0f..f000558100 100755
--- a/lib/ssh/src/ssh_sftp.erl
+++ b/lib/ssh/src/ssh_sftp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -130,9 +130,9 @@ start_channel(Host, Port, Opts) ->
end.
stop_channel(Pid) ->
- case process_info(Pid, [trap_exit]) of
- [{trap_exit, Bool}] ->
- process_flag(trap_exit, true),
+ case is_process_alive(Pid) of
+ true ->
+ OldValue = process_flag(trap_exit, true),
link(Pid),
exit(Pid, ssh_sftp_stop_channel),
receive
@@ -145,9 +145,9 @@ stop_channel(Pid) ->
ok
end
end,
- process_flag(trap_exit, Bool),
+ process_flag(trap_exit, OldValue),
ok;
- undefined ->
+ false ->
ok
end.