aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/disk_log_server.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-04-22 15:28:49 +0200
committerHans Bolinder <[email protected]>2013-05-06 12:14:12 +0200
commit21a7806986d58480367cff8d385a12f9659c7754 (patch)
treecba88bf517ff4f86b86bb0d649f5204bac4d9ade /lib/kernel/src/disk_log_server.erl
parent0dc5a00011d1d24b68c9d43ff608415f84c50499 (diff)
downloadotp-21a7806986d58480367cff8d385a12f9659c7754.tar.gz
otp-21a7806986d58480367cff8d385a12f9659c7754.tar.bz2
otp-21a7806986d58480367cff8d385a12f9659c7754.zip
Fix unmatched_returns warnings in STDLIB and Kernel
Diffstat (limited to 'lib/kernel/src/disk_log_server.erl')
-rw-r--r--lib/kernel/src/disk_log_server.erl20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/kernel/src/disk_log_server.erl b/lib/kernel/src/disk_log_server.erl
index 8894ed87e8..684ea5b5db 100644
--- a/lib/kernel/src/disk_log_server.erl
+++ b/lib/kernel/src/disk_log_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -83,8 +83,8 @@ accessible_logs() ->
init([]) ->
process_flag(trap_exit, true),
- ets:new(?DISK_LOG_NAME_TABLE, [named_table, set]),
- ets:new(?DISK_LOG_PID_TABLE, [named_table, set]),
+ _ = ets:new(?DISK_LOG_NAME_TABLE, [named_table, set]),
+ _= ets:new(?DISK_LOG_PID_TABLE, [named_table, set]),
{ok, #state{}}.
handle_call({open, W, A}, From, State) ->
@@ -159,15 +159,25 @@ ensure_started() ->
undefined ->
LogSup = {disk_log_sup, {disk_log_sup, start_link, []}, permanent,
1000, supervisor, [disk_log_sup]},
- supervisor:start_child(kernel_safe_sup, LogSup),
+ {ok, _} = ensure_child_started(kernel_safe_sup, LogSup),
LogServer = {disk_log_server,
{disk_log_server, start_link, []},
permanent, 2000, worker, [disk_log_server]},
- supervisor:start_child(kernel_safe_sup, LogServer),
+ {ok, _} = ensure_child_started(kernel_safe_sup, LogServer),
ok;
_ -> ok
end.
+ensure_child_started(Sup,Child) ->
+ case supervisor:start_child(Sup, Child) of
+ {ok,Pid} ->
+ {ok,Pid};
+ {error,{already_started,Pid}} ->
+ {ok,Pid};
+ Error ->
+ Error
+ end.
+
open([{Req, From} | L], State) ->
State2 = case do_open(Req, From, State) of
{pending, State1} ->