aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen_server.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_server.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_server.erl')
-rw-r--r--lib/stdlib/src/gen_server.erl11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl
index ac81df9cab..09d94a9c40 100644
--- a/lib/stdlib/src/gen_server.erl
+++ b/lib/stdlib/src/gen_server.erl
@@ -840,15 +840,8 @@ name_to_pid(Name) ->
%%-----------------------------------------------------------------
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, State, Mod, _Time]] = StatusData,
- 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,
+ Header = gen:format_status_header("Status for generic server",
+ Name),
Log = sys:get_debug(log, Debug, []),
DefaultStatus = [{data, [{"State", State}]}],
Specfic =