diff options
author | Erlang/OTP <[email protected]> | 2010-05-28 09:39:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-05-28 09:39:40 +0000 |
commit | 56f23b4aca7c8bfcceeb0095536926ddb1a8102c (patch) | |
tree | 776e4600afde665884bbd6642a48bba1fbbce27e /lib/stdlib/src | |
parent | 3bfea34b08b4593dbda83677fe2611c4e440fd9a (diff) | |
parent | dab11bf07c66e1f119cc5d6198c8e90c5a02219e (diff) | |
download | otp-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')
-rw-r--r-- | lib/stdlib/src/gen_fsm.erl | 15 | ||||
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 15 |
2 files changed, 18 insertions, 12 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 = diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index dc8e7ecd16..ac81df9cab 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -840,12 +840,15 @@ name_to_pid(Name) -> %%----------------------------------------------------------------- format_status(Opt, StatusData) -> [PDict, SysState, Parent, Debug, [Name, State, Mod, _Time]] = StatusData, - NameTag = if is_pid(Name) -> - pid_to_list(Name); - is_atom(Name) -> - Name - end, - Header = lists:concat(["Status for generic server ", NameTag]), + StatusHdr = "Status for generic server", + 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, [{"State", State}]}], Specfic = |