aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen_fsm.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-05-28 09:39:40 +0000
committerErlang/OTP <[email protected]>2010-05-28 09:39:40 +0000
commit56f23b4aca7c8bfcceeb0095536926ddb1a8102c (patch)
tree776e4600afde665884bbd6642a48bba1fbbce27e /lib/stdlib/src/gen_fsm.erl
parent3bfea34b08b4593dbda83677fe2611c4e440fd9a (diff)
parentdab11bf07c66e1f119cc5d6198c8e90c5a02219e (diff)
downloadotp-56f23b4aca7c8bfcceeb0095536926ddb1a8102c.tar.gz
otp-56f23b4aca7c8bfcceeb0095536926ddb1a8102c.tar.bz2
otp-56f23b4aca7c8bfcceeb0095536926ddb1a8102c.zip
Merge branch 'sv/format_status-name-handling' into dev
* sv/format_status-name-handling: handle {global, term()} names in format_status/2 OTP-8656 sv/format_status-name-handling Calling sys:get_status() for processes that have globally registered names that were not atoms would cause a crash. Corrected. (Thanks to Steve Vinoski.)
Diffstat (limited to 'lib/stdlib/src/gen_fsm.erl')
-rw-r--r--lib/stdlib/src/gen_fsm.erl15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index 8d1b46d6ab..7d9960b912 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -614,12 +614,15 @@ get_msg(Msg) -> Msg.
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] =
StatusData,
- NameTag = if is_pid(Name) ->
- pid_to_list(Name);
- is_atom(Name) ->
- Name
- end,
- Header = lists:concat(["Status for state machine ", NameTag]),
+ StatusHdr = "Status for state machine",
+ Header = if
+ is_pid(Name) ->
+ lists:concat([StatusHdr, " ", pid_to_list(Name)]);
+ is_atom(Name); is_list(Name) ->
+ lists:concat([StatusHdr, " ", Name]);
+ true ->
+ {StatusHdr, Name}
+ end,
Log = sys:get_debug(log, Debug, []),
DefaultStatus = [{data, [{"StateData", StateData}]}],
Specfic =