aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2009-11-28 21:11:35 -0500
committerSteve Vinoski <[email protected]>2009-11-29 11:06:13 -0500
commit2a9b7a1c7816812dd637933a8fbf61bed6742785 (patch)
treee18e228fb9f75dc8a96993086e5ec2ac3e8bff87 /lib
parent84adefa331c4159d432d22840663c38f155cd4c1 (diff)
downloadotp-2a9b7a1c7816812dd637933a8fbf61bed6742785.tar.gz
otp-2a9b7a1c7816812dd637933a8fbf61bed6742785.tar.bz2
otp-2a9b7a1c7816812dd637933a8fbf61bed6742785.zip
gen_fsm: Fix format_status/2 to handle Pids
gen_fsm:format_status/2 currently crashes if Name in the process state is a Pid. Handle Name in the same way as in gen_server:format_status/2 to eliminate the crash.
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/gen_fsm.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index f3775f967a..ba0275ae2b 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -603,7 +603,12 @@ get_msg(Msg) -> Msg.
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] =
StatusData,
- Header = lists:concat(["Status for state machine ", Name]),
+ NameTag = if is_pid(Name) ->
+ pid_to_list(Name);
+ is_atom(Name) ->
+ Name
+ end,
+ Header = lists:concat(["Status for state machine ", NameTag]),
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of