aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen_fsm.erl
diff options
context:
space:
mode:
authorGeoff Cant <[email protected]>2010-06-12 16:49:54 -0700
committerRaimo Niskanen <[email protected]>2010-07-07 16:34:09 +0200
commit95ed86fc9893460751c5141ff872bdc13814a273 (patch)
tree1722de5f58c95432ca4de75e590c9c90aa4a8334 /lib/stdlib/src/gen_fsm.erl
parentc752a4ea65c744ac283cc277717f8defa15ae610 (diff)
downloadotp-95ed86fc9893460751c5141ff872bdc13814a273.tar.gz
otp-95ed86fc9893460751c5141ff872bdc13814a273.tar.bz2
otp-95ed86fc9893460751c5141ff872bdc13814a273.zip
Fix format_status bug for unregistered gen_event processes
Port the gen_fsm code for format_status to gen_event in order to prevent a lists:concat([...,pid()]) crash when calling sys:get_status/1 on an unregistered gen_event process. Refactor format_status header code from gen_* behaviours to module gen. Extend the format_status tests in gen_event_SUITE to cover format_status bugs with anonymous gen_event processes.
Diffstat (limited to 'lib/stdlib/src/gen_fsm.erl')
-rw-r--r--lib/stdlib/src/gen_fsm.erl11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index 7d9960b912..f2f1365d3d 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -614,15 +614,8 @@ get_msg(Msg) -> Msg.
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] =
StatusData,
- 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,
+ Header = gen:format_status_header("Status for state machine",
+ Name),
Log = sys:get_debug(log, Debug, []),
DefaultStatus = [{data, [{"StateData", StateData}]}],
Specfic =