aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/debugger/src/dbg_icmd.erl7
-rw-r--r--lib/kernel/src/application_controller.erl6
-rw-r--r--lib/kernel/src/application_master.erl8
-rw-r--r--lib/kernel/src/auth.erl4
-rw-r--r--lib/kernel/src/code.erl2
-rw-r--r--lib/kernel/src/code_server.erl6
-rw-r--r--lib/kernel/src/disk_log.erl13
-rw-r--r--lib/kernel/src/disk_log_1.erl78
-rw-r--r--lib/kernel/src/disk_log_server.erl20
-rw-r--r--lib/kernel/src/dist_ac.erl46
-rw-r--r--lib/kernel/src/erl_boot_server.erl20
-rw-r--r--lib/kernel/src/erl_epmd.erl32
-rw-r--r--lib/kernel/src/erts_debug.erl4
-rw-r--r--lib/kernel/src/file.erl39
-rw-r--r--lib/kernel/src/file_io_server.erl14
-rw-r--r--lib/kernel/src/file_server.erl3
-rw-r--r--lib/kernel/src/gen_sctp.erl4
-rw-r--r--lib/kernel/src/gen_tcp.erl2
-rw-r--r--lib/kernel/src/global.erl5
-rw-r--r--lib/kernel/src/global_group.erl13
-rw-r--r--lib/kernel/src/group.erl8
-rw-r--r--lib/kernel/src/heart.erl20
-rw-r--r--lib/kernel/src/inet.erl10
-rw-r--r--lib/kernel/src/inet6_tcp_dist.erl2
-rw-r--r--lib/kernel/src/inet_db.erl10
-rw-r--r--lib/kernel/src/inet_gethost_native.erl8
-rw-r--r--lib/kernel/src/inet_parse.erl2
-rw-r--r--lib/kernel/src/inet_res.erl10
-rw-r--r--lib/kernel/src/inet_tcp_dist.erl2
-rw-r--r--lib/kernel/src/net_kernel.erl2
-rw-r--r--lib/kernel/src/os.erl6
-rw-r--r--lib/kernel/src/pg2.erl18
-rw-r--r--lib/kernel/src/rpc.erl28
-rw-r--r--lib/kernel/src/standard_error.erl6
-rw-r--r--lib/kernel/src/user.erl8
-rw-r--r--lib/kernel/src/user_drv.erl41
-rw-r--r--lib/kernel/src/wrap_log_reader.erl10
-rw-r--r--lib/stdlib/src/beam_lib.erl2
-rw-r--r--lib/stdlib/src/c.erl2
-rw-r--r--lib/stdlib/src/dets.erl88
-rw-r--r--lib/stdlib/src/dets_server.erl8
-rw-r--r--lib/stdlib/src/dets_utils.erl24
-rw-r--r--lib/stdlib/src/dets_v8.erl8
-rw-r--r--lib/stdlib/src/dets_v9.erl14
-rw-r--r--lib/stdlib/src/digraph_utils.erl4
-rw-r--r--lib/stdlib/src/epp.erl2
-rw-r--r--lib/stdlib/src/erl_tar.erl5
-rw-r--r--lib/stdlib/src/error_logger_tty_h.erl11
-rw-r--r--lib/stdlib/src/escript.erl8
-rw-r--r--lib/stdlib/src/ets.erl33
-rw-r--r--lib/stdlib/src/file_sorter.erl32
-rw-r--r--lib/stdlib/src/filelib.erl2
-rw-r--r--lib/stdlib/src/gen_fsm.erl4
-rw-r--r--lib/stdlib/src/gen_server.erl4
-rw-r--r--lib/stdlib/src/log_mf_h.erl13
-rw-r--r--lib/stdlib/src/pool.erl4
-rw-r--r--lib/stdlib/src/shell.erl8
-rw-r--r--lib/stdlib/src/supervisor.erl13
-rw-r--r--lib/stdlib/src/sys.erl4
-rw-r--r--lib/stdlib/src/timer.erl4
60 files changed, 459 insertions, 355 deletions
diff --git a/lib/debugger/src/dbg_icmd.erl b/lib/debugger/src/dbg_icmd.erl
index b230efaa7a..b1bf4ebecc 100644
--- a/lib/debugger/src/dbg_icmd.erl
+++ b/lib/debugger/src/dbg_icmd.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -399,7 +399,7 @@ eval_restricted({From,_Mod,Cmd,SP}, Bs) ->
eval_nonrestricted({From,Mod,Cmd,SP}, Bs, #ieval{level=Le}) when SP < Le->
%% Evaluate in stack
- eval_restricted({From, Mod, Cmd, SP}, Bs),
+ _ = eval_restricted({From, Mod, Cmd, SP}, Bs),
Bs;
eval_nonrestricted({From, _Mod, Cmd, _SP}, Bs,
#ieval{level=Le,module=M,line=Line}=Ieval) ->
@@ -465,7 +465,8 @@ tell_attached(Msg) ->
case get(attached) of
undefined -> ignore;
AttPid ->
- AttPid ! {self(), Msg}
+ AttPid ! {self(), Msg},
+ ignore
end.
%%====================================================================
diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl
index 9ed2c7a7d9..1a4473593a 100644
--- a/lib/kernel/src/application_controller.erl
+++ b/lib/kernel/src/application_controller.erl
@@ -488,7 +488,7 @@ init(Init, Kernel) ->
%% called during start-up of any app.
case check_conf_data(ConfData) of
ok ->
- ets:new(ac_tab, [set, public, named_table]),
+ _ = ets:new(ac_tab, [set, public, named_table]),
S = #state{conf_data = ConfData},
{ok, KAppl} = make_appl(Kernel),
case catch load(S, KAppl) of
@@ -1949,10 +1949,10 @@ test_change_apps(Apps, Conf) ->
test_do_change_appl([], _, _) ->
ok;
test_do_change_appl([A|Apps], [], [R|Res]) ->
- do_change_appl(R, #appl{name = A}, []),
+ _ = do_change_appl(R, #appl{name = A}, []),
test_do_change_appl(Apps, [], Res);
test_do_change_appl([A|Apps], [C|Conf], [R|Res]) ->
- do_change_appl(R, #appl{name = A}, C),
+ _ = do_change_appl(R, #appl{name = A}, C),
test_do_change_appl(Apps, Conf, Res).
test_make_apps([], Res) ->
diff --git a/lib/kernel/src/application_master.erl b/lib/kernel/src/application_master.erl
index 34a3efcaf2..68f78c6eb8 100644
--- a/lib/kernel/src/application_master.erl
+++ b/lib/kernel/src/application_master.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -125,7 +125,7 @@ init(Parent, Starter, ApplData, Type) ->
State = #state{appl_data = ApplData, gleader = OldGleader},
case start_it(State, Type) of
{ok, Pid} -> % apply(M,F,A) returned ok
- set_timer(ApplData#appl_data.maxT),
+ ok = set_timer(ApplData#appl_data.maxT),
unlink(Starter),
proc_lib:init_ack(Starter, {ok,self()}),
main_loop(Parent, State#state{child = Pid});
@@ -418,4 +418,6 @@ kill_all_procs_1([], _, 0) -> ok;
kill_all_procs_1([], _, _) -> kill_all_procs().
set_timer(infinity) -> ok;
-set_timer(Time) -> timer:exit_after(Time, timeout).
+set_timer(Time) ->
+ {ok, _} = timer:exit_after(Time, timeout),
+ ok.
diff --git a/lib/kernel/src/auth.erl b/lib/kernel/src/auth.erl
index 7d463103e3..eda35147d3 100644
--- a/lib/kernel/src/auth.erl
+++ b/lib/kernel/src/auth.erl
@@ -324,7 +324,7 @@ read_cookie(Name, Size) ->
{ok, File} ->
case file:read(File, Size) of
{ok, List} ->
- file:close(File),
+ ok = file:close(File),
check_cookie(List, []);
{error, Reason} ->
make_error(Name, Reason)
@@ -376,7 +376,7 @@ create_cookie(Name) ->
case file:open(Name, [write, raw]) of
{ok, File} ->
R1 = file:write(File, Cookie),
- file:close(File),
+ ok = file:close(File),
R2 = file:raw_write_file_info(Name, make_info(Name)),
case {R1, R2} of
{ok, ok} ->
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index 03fba96d4b..0eda558ed5 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -364,7 +364,7 @@ load_code_server_prerequisites() ->
lists,
os,
unicode],
- [M = M:module_info(module) || M <- Needed],
+ _ = [M = M:module_info(module) || M <- Needed],
ok.
do_stick_dirs() ->
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 5d74e8620b..9358e2201e 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -153,7 +153,7 @@ loop(#state{supervisor=Supervisor}=State0) ->
{code_call, Pid, Req} ->
case handle_call(Req, {Pid, call}, State0) of
{reply, Res, State} ->
- reply(Pid, Res),
+ _ = reply(Pid, Res),
loop(State);
{noreply, State} ->
loop(State);
@@ -1505,13 +1505,13 @@ finish_on_load_1(Mod, File, OnLoadRes, WaitingPids, Db) ->
erlang:finish_after_on_load(Mod, Keep),
Res = case Keep of
false ->
- finish_on_load_report(Mod, OnLoadRes),
+ _ = finish_on_load_report(Mod, OnLoadRes),
{error,on_load_failure};
true ->
ets:insert(Db, {Mod,File}),
{module,Mod}
end,
- [reply(Pid, Res) || Pid <- WaitingPids],
+ _ = [reply(Pid, Res) || Pid <- WaitingPids],
ok.
finish_on_load_report(_Mod, Atom) when is_atom(Atom) ->
diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl
index c238eff12f..9a7726cfa0 100644
--- a/lib/kernel/src/disk_log.erl
+++ b/lib/kernel/src/disk_log.erl
@@ -1076,13 +1076,13 @@ log_end(S, [], [], Sync) ->
log_end(S, Pids, Bins, Sync) ->
case do_log(get(log), rflat(Bins)) of
N when is_integer(N) ->
- replies(Pids, ok),
+ ok = replies(Pids, ok),
S1 = (state_ok(S))#state{cnt = S#state.cnt+N},
log_end_sync(S1, Sync);
{error, {error, {full, _Name}}, N} when Pids =:= [] ->
log_end_sync(state_ok(S#state{cnt = S#state.cnt + N}), Sync);
{error, Error, N} ->
- replies(Pids, Error),
+ ok = replies(Pids, Error),
state_err(S#state{cnt = S#state.cnt + N}, Error)
end.
@@ -1091,7 +1091,7 @@ log_end_sync(S, []) ->
S;
log_end_sync(S, Sync) ->
Res = do_sync(get(log)),
- replies(Sync, Res),
+ ok = replies(Sync, Res),
state_err(S, Res).
%% Inlined.
@@ -1183,7 +1183,7 @@ do_exit(S, From, Message0, Reason) ->
_ -> Message0
end,
_ = disk_log_server:close(self()),
- replies(From, Message),
+ ok = replies(From, Message),
?PROFILE(ep:done()),
exit(Reason).
@@ -1881,7 +1881,8 @@ replies(Pids, Reply) ->
send_reply(Pids, M).
send_reply(Pid, M) when is_pid(Pid) ->
- Pid ! M;
+ Pid ! M,
+ ok;
send_reply([Pid | Pids], M) ->
Pid ! M,
send_reply(Pids, M);
@@ -2022,7 +2023,7 @@ notify_owners(Note) ->
cache_error(S, Pids) ->
Error = S#state.cache_error,
- replies(Pids, Error),
+ ok = replies(Pids, Error),
state_err(S#state{cache_error = ok}, Error).
state_ok(S) ->
diff --git a/lib/kernel/src/disk_log_1.erl b/lib/kernel/src/disk_log_1.erl
index 9d431bdd30..59f5cad001 100644
--- a/lib/kernel/src/disk_log_1.erl
+++ b/lib/kernel/src/disk_log_1.erl
@@ -295,12 +295,18 @@ read_chunk_ro(FdC, FileName, Pos, MaxBytes) ->
pread(FdC, FileName, Pos + ?HEADSZ, MaxBytes).
%% -> ok | throw(Error)
-close(#cache{fd = Fd, c = []}, _FileName, read_only) ->
- file:close(Fd);
+close(#cache{fd = Fd, c = []}, FileName, read_only) ->
+ case file:close(Fd) of
+ ok -> ok;
+ Error -> file_error(FileName, Error)
+ end;
close(#cache{fd = Fd, c = C}, FileName, read_write) ->
{Reply, _NewFdC} = write_cache(Fd, FileName, C),
mark(Fd, FileName, ?CLOSED),
- file:close(Fd),
+ case file:close(Fd) of
+ ok -> ok;
+ Error -> file_error(FileName, Error)
+ end,
if Reply =:= ok -> ok; true -> throw(Reply) end.
%% Open an internal file. Head is ignored if Mode is read_only.
@@ -320,7 +326,10 @@ int_open(FName, Repair, read_write, Head) ->
{ok, FileHead} ->
case is_head(FileHead) of
yes ->
- file:close(Fd),
+ case file:close(Fd) of
+ ok -> ok;
+ Error2 -> file_error(FName, Error2)
+ end,
case open_update(FName) of
{ok, Fd2} ->
mark(Fd2, FName, ?OPENED),
@@ -333,14 +342,14 @@ int_open(FName, Repair, read_write, Head) ->
yes_not_closed when Repair ->
repair(Fd, FName);
yes_not_closed when not Repair ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {need_repair, FName}});
no ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {not_a_log_file, FName}})
end;
eof ->
- file:close(Fd),
+ _= file:close(Fd),
throw({error, {not_a_log_file, FName}});
Error ->
file_error_close(Fd, FName, Error)
@@ -363,11 +372,11 @@ int_open(FName, _Repair, read_only, _Head) ->
FdC = #cache{fd = Fd},
{ok, {existed, FdC, {0, 0}, P}};
no ->
- file:close(Fd),
+ _= file:close(Fd),
throw({error, {not_a_log_file, FName}})
end;
eof ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {not_a_log_file, FName}});
Error ->
file_error_close(Fd, FName, Error)
@@ -398,7 +407,7 @@ int_log_head(Fd, Head) ->
none ->
{#cache{fd = Fd}, 0, 0};
Error ->
- file:close(Fd),
+ _= file:close(Fd),
throw(Error)
end.
@@ -450,13 +459,13 @@ ext_log_head(Fd, Head) ->
none ->
{#cache{fd = Fd}, {0, 0}};
Error ->
- file:close(Fd),
+ _= file:close(Fd),
throw(Error)
end.
%% -> _Any | throw()
mark(Fd, FileName, What) ->
- position_close2(Fd, FileName, 4),
+ {ok, _} = position_close2(Fd, FileName, 4),
fwrite_close2(Fd, FileName, What).
%% -> {ok, Bin} | Error
@@ -560,7 +569,7 @@ scan_f2(B, FSz, Ack, No, Bad, Size, Tail) ->
end.
done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) ->
- file:close(In),
+ _ = file:close(In),
case catch fclose(Out, OutName) of
ok ->
case file:rename(OutName, FName) of
@@ -574,21 +583,21 @@ done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) ->
file_error(FName, Error)
end;
Error ->
- file:delete(OutName),
+ _ = file:delete(OutName),
file_error(FName, Error)
end;
Error ->
- file:delete(OutName),
+ _ = file:delete(OutName),
throw(Error)
end.
-spec repair_err(file:io_device(), #cache{}, file:filename(),
file:filename(), {'error', file:posix()}) -> no_return().
repair_err(In, Out, OutName, ErrFileName, Error) ->
- file:close(In),
+ _= file:close(In),
catch fclose(Out, OutName),
%% OutName is often the culprit, try to remove it anyway...
- file:delete(OutName),
+ _ = file:delete(OutName),
file_error(ErrFileName, Error).
%% Used by wrap_log_reader.
@@ -764,10 +773,10 @@ mf_int_chunk(Handle, {FileNo, Pos}, Bin, N) ->
{ok, {_Alloc, FdC, _HeadSize, _FileSize}} ->
case chunk(FdC, FName, Pos, Bin, N) of
{NewFdC, eof} ->
- file:close(NewFdC#cache.fd),
+ _ = file:close(NewFdC#cache.fd),
mf_int_chunk(Handle, {NFileNo, 0}, [], N);
{NewFdC, Other} ->
- file:close(NewFdC#cache.fd),
+ _ = file:close(NewFdC#cache.fd),
{Handle, conv(Other, FileNo)}
end
end.
@@ -792,10 +801,10 @@ mf_int_chunk_read_only(Handle, {FileNo, Pos}, Bin, N) ->
{ok, {_Alloc, FdC, _HeadSize, _FileSize}} ->
case do_chunk_read_only(FdC, FName, Pos, Bin, N) of
{NewFdC, eof} ->
- file:close(NewFdC#cache.fd),
+ _ = file:close(NewFdC#cache.fd),
mf_int_chunk_read_only(Handle, {NFileNo,0}, [], N);
{NewFdC, Other} ->
- file:close(NewFdC#cache.fd),
+ _ = file:close(NewFdC#cache.fd),
{Handle, conv(Other, FileNo)}
end
end.
@@ -1017,7 +1026,7 @@ ext_file_open(FName, NewFile, OldFile, OldCnt, Head, Repair, Mode) ->
read_index_file(truncate, FName, MaxF) ->
remove_files(FName, 2, MaxF),
- file:delete(?index_file_name(FName)),
+ _ = file:delete(?index_file_name(FName)),
{1, 0, 0, 0};
read_index_file(_, FName, _MaxF) ->
read_index_file(FName).
@@ -1043,7 +1052,7 @@ read_index_file(FName) ->
_ErrorOrEof ->
{1, 0, 0, 0}
end,
- file:close(Fd),
+ _ = file:close(Fd),
R;
_Error ->
{1, 0, 0, 0}
@@ -1096,7 +1105,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) ->
%% Very old format, convert to the latest format!
case file:read_file(FileName) of
{ok, <<_CurF, Tail/binary>>} ->
- position_close2(Fd, FileName, bof),
+ {ok, _} = position_close2(Fd, FileName, bof),
Bin = <<0, 0:32, ?VERSION, NewFile:32>>,
NewTail = to_8_bytes(Tail, [], FileName, Fd),
fwrite_close2(Fd, FileName, [Bin | NewTail]),
@@ -1115,7 +1124,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) ->
R = file:pread(Fd, NewPos, SzSz),
OldPos = Offset + (OldFile - 1)*SzSz,
pwrite_close2(Fd, FileName, OldPos, OldCntBin),
- file:close(Fd),
+ _ = file:close(Fd),
case R of
{ok, <<Lost:SzSz/unit:8>>} -> Lost;
{ok, _} ->
@@ -1125,7 +1134,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) ->
end;
true ->
pwrite_close2(Fd, FileName, NewPos, OldCntBin),
- file:close(Fd),
+ _ = file:close(Fd),
0
end;
E ->
@@ -1137,7 +1146,7 @@ to_8_bytes(<<N:32,T/binary>>, NT, FileName, Fd) ->
to_8_bytes(B, NT, _FileName, _Fd) when byte_size(B) =:= 0 ->
NT;
to_8_bytes(_B, _NT, FileName, Fd) ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {invalid_index_file, FileName}}).
%% -> ok | throw(FileError)
@@ -1147,7 +1156,7 @@ index_file_trunc(FName, N) ->
{ok, Fd} ->
case file:read(Fd, 6) of
eof ->
- file:close(Fd),
+ _ = file:close(Fd),
ok;
{ok, <<0, 0:32, Version>>} when Version =:= ?VERSION ->
truncate_index_file(Fd, FileName, 10, 8, N);
@@ -1166,10 +1175,10 @@ truncate_index_file(Fd, FileName, Offset, N, SzSz) ->
Pos = Offset + N*SzSz,
case Pos > file_size(FileName) of
true ->
- file:close(Fd);
+ ok = file:close(Fd);
false ->
truncate_at_close2(Fd, FileName, {bof, Pos}),
- file:close(Fd)
+ ok = file:close(Fd)
end,
ok.
@@ -1412,7 +1421,8 @@ fwrite(#cache{c = []} = FdC, _FN, B, Size) ->
ok;
_ ->
put(write_cache_timer_is_running, true),
- erlang:send_after(?TIMEOUT, self(), {self(), write_cache})
+ erlang:send_after(?TIMEOUT, self(), {self(), write_cache}),
+ ok
end,
{ok, FdC#cache{sz = Size, c = B}};
fwrite(#cache{sz = Sz, c = C} = FdC, _FN, B, Size) when Sz < ?MAX ->
@@ -1511,7 +1521,7 @@ position_close2(Fd, FileName, Pos) ->
end.
truncate_at_close2(Fd, FileName, Pos) ->
- position_close2(Fd, FileName, Pos),
+ {ok, _} = position_close2(Fd, FileName, Pos),
case file:truncate(Fd) of
ok -> ok;
Error -> file_error_close(Fd, FileName, Error)
@@ -1519,7 +1529,7 @@ truncate_at_close2(Fd, FileName, Pos) ->
fclose(#cache{fd = Fd, c = C}, FileName) ->
%% The cache is empty if the file was opened in read_only mode.
- write_cache_close(Fd, FileName, C),
+ _ = write_cache_close(Fd, FileName, C),
file:close(Fd).
%% -> {Reply, #cache{}}; Reply = ok | Error
@@ -1549,5 +1559,5 @@ file_error(FileName, {error, Error}) ->
-spec file_error_close(file:fd(), file:filename(), {'error', file:posix()}) -> no_return().
file_error_close(Fd, FileName, {error, Error}) ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {file_error, FileName, Error}}).
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} ->
diff --git a/lib/kernel/src/dist_ac.erl b/lib/kernel/src/dist_ac.erl
index 5c62aa31e9..98b9e20007 100644
--- a/lib/kernel/src/dist_ac.erl
+++ b/lib/kernel/src/dist_ac.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
@@ -321,7 +321,7 @@ handle_call({takeover_application, AppName, RestartType}, From, S) ->
case keysearch(AppName, #appl.name, Appls) of
{value, Appl} when element(1, Appl#appl.id) =:= distributed ->
{distributed, Node} = Appl#appl.id,
- ac_takeover(req, AppName, Node, RestartType),
+ _ = ac_takeover(req, AppName, Node, RestartType),
NAppl = Appl#appl{id = takeover},
NAppls = keyreplace(AppName, #appl.name, Appls, NAppl),
TR = S#state.t_reqs,
@@ -341,10 +341,10 @@ handle_call({permit_application, AppName, Bool, LockId, StartInfo}, From, S) ->
%% here, but we have to be backwards-compatible.
case application_controller:get_loaded(AppName) of
{true, _} when not Bool ->
- ac_stop_it(AppName),
+ _ = ac_stop_it(AppName),
{reply, ok, S};
{true, _} when Bool ->
- ac_start_it(req, AppName),
+ _ = ac_start_it(req, AppName),
{reply, ok, S};
false ->
{reply, {error, {not_loaded, AppName}}, S}
@@ -533,7 +533,7 @@ handle_info({dist_ac_app_started, Node, Name, Res}, S) ->
%% Another node started appl. Update appl list.
{distributed, Node}
end,
- ac_started(req, Name, Node),
+ _ = ac_started(req, Name, Node),
NAppl = Appl#appl{id = NId},
NAppls = keyreplace(Name, #appl.name, Appls, NAppl),
TmpWeights = keydelete_all(Name, 1, S#state.tmp_weights),
@@ -622,7 +622,7 @@ handle_info({nodedown, Node}, S) ->
true ->
{true, Appl#appl{id = {failover, Node}}};
false ->
- ac_not_running(Appl#appl.name),
+ _ = ac_not_running(Appl#appl.name),
{true, Appl#appl{id = undefined}}
end;
(_) ->
@@ -656,7 +656,8 @@ handle_info({dist_ac_app_loaded, Node, Name, HisNodes, Permission, HeKnowsMe},
%% he's a new node connecting to us.
Msg = {dist_ac_app_loaded, node(), Name,
Nodes, dist_is_runnable(Appls, Name), true},
- {?DIST_AC, Node} ! Msg;
+ {?DIST_AC, Node} ! Msg,
+ ok;
true ->
ok
end,
@@ -813,27 +814,27 @@ start_distributed(Appl, Name, Nodes, PermittedNodes, S, Type) ->
{ok, Node} when Node =:= node() ->
case Appl#appl.id of
{failover, FoNode} when Type =:= req ->
- ac_failover(Name, FoNode, undefined);
+ _ = ac_failover(Name, FoNode, undefined);
{distributed, Node2} when Type =:= req ->
- ac_takeover(req, Name, Node2, undefined);
+ _ = ac_takeover(req, Name, Node2, undefined);
_ when Type =:= reply ->
case lists:keysearch(Name, 2, S#state.remote_started) of
{value, {Node3, _}} ->
- ac_takeover(reply, Name, Node3, undefined);
+ _ = ac_takeover(reply, Name, Node3, undefined);
_ ->
- ac_start_it(Type, Name)
+ _ = ac_start_it(Type, Name)
end;
_ ->
- ac_start_it(Type, Name)
+ _ = ac_start_it(Type, Name)
end,
{run_waiting, true};
{already_started, Node} ->
- ac_started(Type, Name, Node),
+ _ = ac_started(Type, Name, Node),
{{distributed, Node}, false};
{ok, Node} ->
case keysearch(Name, #appl.name, S#state.appls) of
{value, #appl{id = {distributed, Node}}} ->
- ac_started(Type, Name, Node),
+ _ = ac_started(Type, Name, Node),
{{distributed, Node}, false};
_ ->
wait_dist_start(Node, Appl, Name, Nodes,
@@ -842,7 +843,7 @@ start_distributed(Appl, Name, Nodes, PermittedNodes, S, Type) ->
not_started ->
wait_dist_start2(Appl, Name, Nodes, PermittedNodes, S, Type);
no_permission ->
- ac_not_started(Type, Name),
+ _ = ac_not_started(Type, Name),
{undefined, false}
end.
@@ -850,11 +851,11 @@ wait_dist_start(Node, Appl, Name, Nodes, PermittedNodes, S, Type) ->
monitor_node(Node, true),
receive
{dist_ac_app_started, Node, Name, ok} ->
- ac_started(Type, Name, Node),
+ _ = ac_started(Type, Name, Node),
monitor_node(Node, false),
{{distributed, Node}, false};
{dist_ac_app_started, Node, Name, {error, R}} ->
- ac_error(Type, Name, {Node, R}),
+ _ = ac_error(Type, Name, {Node, R}),
monitor_node(Node, false),
{Appl#appl.id, false};
{dist_ac_weight, Name, _Weigth, Node} ->
@@ -883,10 +884,10 @@ wait_dist_start(Node, Appl, Name, Nodes, PermittedNodes, S, Type) ->
wait_dist_start2(Appl, Name, Nodes, PermittedNodes, S, Type) ->
receive
{dist_ac_app_started, Node, Name, ok} ->
- ac_started(Type, Name, Node),
+ _ = ac_started(Type, Name, Node),
{{distributed, Node}, false};
{dist_ac_app_started, Node, Name, {error, R}} ->
- ac_error(Type, Name, {Node, R}),
+ _ = ac_error(Type, Name, {Node, R}),
{Appl#appl.id, false};
{nodedown, Node} ->
%% A node went down, try to start the app again - there may not
@@ -974,7 +975,7 @@ permit(false, {value, _}, AppName, From, S, _LockId) ->
case dist_get_runnable_nodes(S#state.appls, AppName) of
[] ->
%% There is no runnable node; stop application
- ac_stop_it(AppName),
+ _ = ac_stop_it(AppName),
SReqs = [{AppName, From} | S#state.s_reqs],
{noreply, S#state{s_reqs = SReqs}};
Nodes ->
@@ -1155,7 +1156,8 @@ send_nodes(Nodes, Msg) ->
end, FlatNodes).
send_after(Time, Msg) when is_integer(Time), Time >= 0 ->
- spawn_link(?MODULE, send_timeout, [self(), Time, Msg]);
+ _Pid = spawn_link(?MODULE, send_timeout, [self(), Time, Msg]),
+ ok;
send_after(_,_) -> % infinity
ok.
@@ -1305,7 +1307,7 @@ check_waiting([{From, AppName, false, Nodes} | Reqs],
S, Node, Appls, Res, SReqs) ->
case lists:delete(Node, Nodes) of
[] ->
- ac_stop_it(AppName),
+ _ = ac_stop_it(AppName),
NSReqs = [{AppName, From} | SReqs],
check_waiting(Reqs, Node, S, Appls, Res, NSReqs);
NNodes ->
diff --git a/lib/kernel/src/erl_boot_server.erl b/lib/kernel/src/erl_boot_server.erl
index 0d68d3e198..33f1b96f8d 100644
--- a/lib/kernel/src/erl_boot_server.erl
+++ b/lib/kernel/src/erl_boot_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -191,7 +191,7 @@ init(Slaves) ->
{ok, UPort} = inet:port(U),
Ref = make_ref(),
Pid = proc_lib:spawn_link(?MODULE, boot_init, [Ref]),
- gen_tcp:controlling_process(L, Pid),
+ ok = gen_tcp:controlling_process(L, Pid),
Pid ! {Ref, L},
%% We trap exit inorder to restart boot_init and udp_port
process_flag(trap_exit, true),
@@ -233,9 +233,19 @@ handle_info({udp, U, IP, Port, Data}, S0) ->
%% erlang version as the boot server node
case {Valid,Data,Token} of
{true,Token,Token} ->
- gen_udp:send(U,IP,Port,[?EBOOT_REPLY,S0#state.priority,
- int16(S0#state.listen_port),
- S0#state.version]),
+ case gen_udp:send(U,IP,Port,[?EBOOT_REPLY,S0#state.priority,
+ int16(S0#state.listen_port),
+ S0#state.version])
+ of
+ ok -> ok;
+ {error, not_owner} ->
+ error_logger:error_msg("** Illegal boot server connection attempt: "
+ "not owner of ~w ** ~n", [U]);
+ {error, Reason} ->
+ Err = file:format_error(Reason),
+ error_logger:error_msg("** Illegal boot server connection attempt: "
+ "~w POSIX error ** ~n", [U, Err])
+ end,
{noreply,S0};
{false,_,_} ->
error_logger:error_msg("** Illegal boot server connection attempt: "
diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl
index 91af49f303..0b97559ec2 100644
--- a/lib/kernel/src/erl_epmd.erl
+++ b/lib/kernel/src/erl_epmd.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -217,17 +217,23 @@ do_register_node(NodeName, TcpPort) ->
Extra = "",
Elen = length(Extra),
Len = 1+2+1+1+2+2+2+length(Name)+2+Elen,
- gen_tcp:send(Socket, [?int16(Len), ?EPMD_ALIVE2_REQ,
- ?int16(TcpPort),
- $M,
- 0,
- ?int16(epmd_dist_high()),
- ?int16(epmd_dist_low()),
- ?int16(length(Name)),
- Name,
- ?int16(Elen),
- Extra]),
- wait_for_reg_reply(Socket, []);
+ Packet = [?int16(Len), ?EPMD_ALIVE2_REQ,
+ ?int16(TcpPort),
+ $M,
+ 0,
+ ?int16(epmd_dist_high()),
+ ?int16(epmd_dist_low()),
+ ?int16(length(Name)),
+ Name,
+ ?int16(Elen),
+ Extra],
+ case gen_tcp:send(Socket, Packet) of
+ ok ->
+ wait_for_reg_reply(Socket, []);
+ Error ->
+ close(Socket),
+ Error
+ end;
Error ->
Error
end.
@@ -374,7 +380,7 @@ wait_for_port_reply_name(Socket, Len, Sofar) ->
% io:format("data = ~p~n", _Data),
wait_for_port_reply_name(Socket, Len, Sofar);
{tcp_closed, Socket} ->
- "foobar"
+ ok
end.
diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl
index 6654cd9ee7..f7a815882b 100644
--- a/lib/kernel/src/erts_debug.erl
+++ b/lib/kernel/src/erts_debug.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1999-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
@@ -288,7 +288,7 @@ dff(Name, Fs) when is_list(Name) ->
try
dff(F, Fs)
after
- file:close(F)
+ _ = file:close(F)
end;
{error,Reason} ->
{error,{badopen,Reason}}
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index 36289053eb..5c0f3b7ceb 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -376,7 +376,7 @@ write_file(Name, Bin, ModeList) when is_list(ModeList) ->
ok ->
close(Handle);
E1 ->
- close(Handle),
+ _ = close(Handle),
E1
end;
E2 ->
@@ -770,7 +770,7 @@ copy_int({SourceName, SourceOpts}, Dest, Length)
case open(Source, [read | SourceOpts]) of
{ok, Handle} ->
Result = copy_opened_int(Handle, Dest, Length, 0),
- close(Handle),
+ _ = close(Handle),
Result;
{error, _} = Error ->
Error
@@ -786,9 +786,16 @@ copy_int(Source, {DestName, DestOpts}, Length)
Dest ->
case open(Dest, [write | DestOpts]) of
{ok, Handle} ->
- Result = copy_opened_int(Source, Handle, Length, 0),
- close(Handle),
- Result;
+ case copy_opened_int(Source, Handle, Length, 0) of
+ {ok, _} = OK ->
+ case close(Handle) of
+ ok -> OK;
+ Error -> Error
+ end;
+ Error ->
+ _ = close(Handle),
+ Error
+ end;
{error, _} = Error ->
Error
end
@@ -957,7 +964,7 @@ consult(File) ->
case open(File, [read]) of
{ok, Fd} ->
R = consult_stream(Fd),
- close(Fd),
+ _ = close(Fd),
R;
Error ->
Error
@@ -977,10 +984,10 @@ path_consult(Path, File) ->
{ok, Fd, Full} ->
case consult_stream(Fd) of
{ok, List} ->
- close(Fd),
+ _ = close(Fd),
{ok, List, Full};
E1 ->
- close(Fd),
+ _ = close(Fd),
E1
end;
E2 ->
@@ -1005,7 +1012,7 @@ eval(File, Bs) ->
case open(File, [read]) of
{ok, Fd} ->
R = eval_stream(Fd, ignore, Bs),
- close(Fd),
+ _ = close(Fd),
R;
Error ->
Error
@@ -1035,10 +1042,10 @@ path_eval(Path, File, Bs) ->
{ok, Fd, Full} ->
case eval_stream(Fd, ignore, Bs) of
ok ->
- close(Fd),
+ _ = close(Fd),
{ok, Full};
E1 ->
- close(Fd),
+ _ = close(Fd),
E1
end;
E2 ->
@@ -1065,7 +1072,7 @@ script(File, Bs) ->
case open(File, [read]) of
{ok, Fd} ->
R = eval_stream(Fd, return, Bs),
- close(Fd),
+ _ = close(Fd),
R;
Error ->
Error
@@ -1098,10 +1105,10 @@ path_script(Path, File, Bs) ->
{ok,Fd,Full} ->
case eval_stream(Fd, return, Bs) of
{ok,R} ->
- close(Fd),
+ _ = close(Fd),
{ok, R, Full};
E1 ->
- close(Fd),
+ _ = close(Fd),
E1
end;
E2 ->
@@ -1247,7 +1254,7 @@ sendfile(Filename, Sock) ->
{error, Reason};
{ok, Fd} ->
Res = sendfile(Fd, Sock, 0, 0, []),
- file:close(Fd),
+ _ = file:close(Fd),
Res
end.
@@ -1298,7 +1305,7 @@ sendfile_fallback(File, Sock, Offset, Bytes, ChunkSize) ->
{ok, CurrPos} = file:position(File, {cur, 0}),
{ok, _NewPos} = file:position(File, {bof, Offset}),
Res = sendfile_fallback_int(File, Sock, Bytes, ChunkSize, 0),
- file:position(File, {bof, CurrPos}),
+ _ = file:position(File, {bof, CurrPos}),
Res.
diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl
index 07fb55f390..0e9ff5bc0f 100644
--- a/lib/kernel/src/file_io_server.erl
+++ b/lib/kernel/src/file_io_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2000-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
@@ -162,29 +162,29 @@ server_loop(#state{mref = Mref} = State) ->
{file_request, From, ReplyAs, Request} when is_pid(From) ->
case file_request(Request, State) of
{reply, Reply, NewState} ->
- file_reply(From, ReplyAs, Reply),
+ _ = file_reply(From, ReplyAs, Reply),
server_loop(NewState);
{error, Reply, NewState} ->
%% error is the same as reply, except that
%% it breaks the io_request_loop further down
- file_reply(From, ReplyAs, Reply),
+ _ = file_reply(From, ReplyAs, Reply),
server_loop(NewState);
{stop, Reason, Reply, _NewState} ->
- file_reply(From, ReplyAs, Reply),
+ _ = file_reply(From, ReplyAs, Reply),
exit(Reason)
end;
{io_request, From, ReplyAs, Request} when is_pid(From) ->
case io_request(Request, State) of
{reply, Reply, NewState} ->
- io_reply(From, ReplyAs, Reply),
+ _ = io_reply(From, ReplyAs, Reply),
server_loop(NewState);
{error, Reply, NewState} ->
%% error is the same as reply, except that
%% it breaks the io_request_loop further down
- io_reply(From, ReplyAs, Reply),
+ _ = io_reply(From, ReplyAs, Reply),
server_loop(NewState);
{stop, Reason, Reply, _NewState} ->
- io_reply(From, ReplyAs, Reply),
+ _ = io_reply(From, ReplyAs, Reply),
exit(Reason)
end;
{'DOWN', Mref, _, _, Reason} ->
diff --git a/lib/kernel/src/file_server.erl b/lib/kernel/src/file_server.erl
index d036dbb516..eabf0401a3 100644
--- a/lib/kernel/src/file_server.erl
+++ b/lib/kernel/src/file_server.erl
@@ -78,7 +78,8 @@ init([]) ->
process_flag(trap_exit, true),
case ?PRIM_FILE:start() of
{ok, Handle} ->
- ets:new(?FILE_IO_SERVER_TABLE, [named_table]),
+ ?FILE_IO_SERVER_TABLE =
+ ets:new(?FILE_IO_SERVER_TABLE, [named_table]),
{ok, Handle};
{error, Reason} ->
{stop, Reason}
diff --git a/lib/kernel/src/gen_sctp.erl b/lib/kernel/src/gen_sctp.erl
index 74ad192802..81c9fbe55f 100644
--- a/lib/kernel/src/gen_sctp.erl
+++ b/lib/kernel/src/gen_sctp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2007-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
@@ -270,7 +270,7 @@ do_connect(S, Addr, Port, Opts, Timeout, ConnWait) when is_port(S), is_list(Opts
Mod:connect(S, IP, Port, Opts, ConnectTimer);
Error -> Error
after
- inet:stop_timer(Timer)
+ _ = inet:stop_timer(Timer)
end
catch
error:badarg ->
diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl
index a98ed4c238..96026aa428 100644
--- a/lib/kernel/src/gen_tcp.erl
+++ b/lib/kernel/src/gen_tcp.erl
@@ -139,7 +139,7 @@ connect(Address, Port, Opts) ->
connect(Address, Port, Opts, Time) ->
Timer = inet:start_timer(Time),
Res = (catch connect1(Address,Port,Opts,Timer)),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
case Res of
{ok,S} -> {ok,S};
{error, einval} -> exit(badarg);
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl
index b24a9d5eac..3f672c099b 100644
--- a/lib/kernel/src/global.erl
+++ b/lib/kernel/src/global.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -2069,7 +2069,8 @@ random_sleep(Times) ->
case get(random_seed) of
undefined ->
{A1, A2, A3} = now(),
- random:seed(A1, A2, A3 + erlang:phash(node(), 100000));
+ random:seed(A1, A2, A3 + erlang:phash(node(), 100000)),
+ ok;
_ -> ok
end,
%% First time 1/4 seconds, then doubling each time up to 8 seconds max.
diff --git a/lib/kernel/src/global_group.erl b/lib/kernel/src/global_group.erl
index 025a9b8a5b..da8b573749 100644
--- a/lib/kernel/src/global_group.erl
+++ b/lib/kernel/src/global_group.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -1149,9 +1149,14 @@ do_unlink(Pid, State) ->
%%%====================================================================================
%%% Send a nodeup/down messages to monitoring Pids in the own global group.
%%%====================================================================================
-send_monitor([P|T], M, no_conf) -> safesend_nc(P, M), send_monitor(T, M, no_conf);
-send_monitor([P|T], M, SyncState) -> safesend(P, M), send_monitor(T, M, SyncState);
-send_monitor([], _, _) -> ok.
+send_monitor([P|T], M, no_conf) ->
+ _ = safesend_nc(P, M),
+ send_monitor(T, M, no_conf);
+send_monitor([P|T], M, SyncState) ->
+ _ = safesend(P, M),
+ send_monitor(T, M, SyncState);
+send_monitor([], _, _) ->
+ ok.
safesend(Name, {Msg, Node}) when is_atom(Name) ->
case lists:member(Node, get_own_nodes()) of
diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl
index ff835e1047..b36dbf33dd 100644
--- a/lib/kernel/src/group.erl
+++ b/lib/kernel/src/group.erl
@@ -309,15 +309,17 @@ io_requests([], Stat, _) ->
%% The ACK contains the return value.
io_reply(From, ReplyAs, Reply) ->
- From ! {io_reply,ReplyAs,Reply}.
+ From ! {io_reply,ReplyAs,Reply},
+ ok.
%% send_drv(Drv, Message)
%% send_drv_reqs(Drv, Requests)
send_drv(Drv, Msg) ->
- Drv ! {self(),Msg}.
+ Drv ! {self(),Msg},
+ ok.
-send_drv_reqs(_Drv, []) -> [];
+send_drv_reqs(_Drv, []) -> ok;
send_drv_reqs(Drv, Rs) ->
send_drv(Drv, {requests,Rs}).
diff --git a/lib/kernel/src/heart.erl b/lib/kernel/src/heart.erl
index 87cb9d7f51..aa65c3a474 100644
--- a/lib/kernel/src/heart.erl
+++ b/lib/kernel/src/heart.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -182,11 +182,11 @@ wait_ack(Port) ->
end.
loop(Parent, Port, Cmd) ->
- send_heart_beat(Port),
+ _ = send_heart_beat(Port),
receive
{From, set_cmd, NewCmd} when length(NewCmd) < 2047 ->
- send_heart_cmd(Port, NewCmd),
- wait_ack(Port),
+ _ = send_heart_cmd(Port, NewCmd),
+ _ = wait_ack(Port),
From ! {heart, ok},
loop(Parent, Port, NewCmd);
{From, set_cmd, NewCmd} ->
@@ -194,8 +194,8 @@ loop(Parent, Port, Cmd) ->
loop(Parent, Port, Cmd);
{From, clear_cmd} ->
From ! {heart, ok},
- send_heart_cmd(Port, ""),
- wait_ack(Port),
+ _ = send_heart_cmd(Port, ""),
+ _ = wait_ack(Port),
loop(Parent, Port, "");
{From, get_cmd} ->
From ! {heart, get_heart_cmd(Port)},
@@ -222,7 +222,7 @@ loop(Parent, Port, Cmd) ->
-spec no_reboot_shutdown(port()) -> no_return().
no_reboot_shutdown(Port) ->
- send_shutdown(Port),
+ _ = send_shutdown(Port),
receive
{'EXIT', Port, Reason} when Reason =/= badsig ->
exit(normal)
@@ -232,10 +232,10 @@ do_cycle_port_program(Caller, Parent, Port, Cmd) ->
unregister(?HEART_PORT_NAME),
case catch start_portprogram() of
{ok, NewPort} ->
- send_shutdown(Port),
+ _ = send_shutdown(Port),
receive
{'EXIT', Port, _Reason} ->
- send_heart_cmd(NewPort, Cmd),
+ _ = send_heart_cmd(NewPort, Cmd),
Caller ! {heart, ok},
loop(Parent, NewPort, Cmd)
after
@@ -243,7 +243,7 @@ do_cycle_port_program(Caller, Parent, Port, Cmd) ->
%% Huh! Two heart port programs running...
%% well, the old one has to be sick not to respond
%% so we'll settle for the new one...
- send_heart_cmd(NewPort, Cmd),
+ _ = send_heart_cmd(NewPort, Cmd),
Caller ! {heart, {error, stop_error}},
loop(Parent, NewPort, Cmd)
end;
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 9670271b2e..b0f4adce2c 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2012. 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
@@ -389,7 +389,7 @@ gethostbyname(Name,Family) ->
gethostbyname(Name,Family,Timeout) ->
Timer = start_timer(Timeout),
Res = gethostbyname_tm(Name,Family,Timer),
- stop_timer(Timer),
+ _ = stop_timer(Timer),
Res.
gethostbyname_tm(Name,Family,Timer) ->
@@ -420,7 +420,7 @@ gethostbyaddr(Address) ->
gethostbyaddr(Address,Timeout) ->
Timer = start_timer(Timeout),
Res = gethostbyaddr_tm(Address, Timer),
- stop_timer(Timer),
+ _ = stop_timer(Timer),
Res.
gethostbyaddr_tm(Address,Timer) ->
@@ -475,7 +475,7 @@ getaddr(Address, Family) ->
getaddr(Address, Family, Timeout) ->
Timer = start_timer(Timeout),
Res = getaddr_tm(Address, Family, Timer),
- stop_timer(Timer),
+ _ = stop_timer(Timer),
Res.
getaddr_tm(Address, Family, Timer) ->
@@ -501,7 +501,7 @@ getaddrs(Address, Family) ->
getaddrs(Address, Family, Timeout) ->
Timer = start_timer(Timeout),
Res = getaddrs_tm(Address, Family, Timer),
- stop_timer(Timer),
+ _ = stop_timer(Timer),
Res.
-spec getservbyport(Port :: port_number(), Protocol :: atom() | string()) ->
diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl
index 2cb0e10c87..459fdc2ad5 100644
--- a/lib/kernel/src/inet6_tcp_dist.erl
+++ b/lib/kernel/src/inet6_tcp_dist.erl
@@ -92,7 +92,7 @@ accept_loop(Kernel, Listen) ->
case inet6_tcp:accept(Listen) of
{ok, Socket} ->
Kernel ! {accept,self(),Socket,inet6,tcp},
- controller(Kernel, Socket),
+ _ = controller(Kernel, Socket),
accept_loop(Kernel, Listen);
Error ->
exit(Error)
diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl
index d4749b9756..8a2994579b 100644
--- a/lib/kernel/src/inet_db.erl
+++ b/lib/kernel/src/inet_db.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. 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
@@ -1112,7 +1112,7 @@ handle_call(Request, From, #state{db=Db}=State) ->
{set_cache_refresh, Time} when is_integer(Time), Time > 0 ->
Time1 = ((Time+999) div 1000)*1000, %% round up
ets:insert(Db, {cache_refresh_interval, Time1}),
- stop_timer(State#state.cache_timer),
+ _ = stop_timer(State#state.cache_timer),
{reply, ok, State#state{cache_timer = init_timer()}};
clear_hosts ->
@@ -1126,7 +1126,7 @@ handle_call(Request, From, #state{db=Db}=State) ->
reset ->
reset_db(Db),
- stop_timer(State#state.cache_timer),
+ _ = stop_timer(State#state.cache_timer),
{reply, ok, State#state{cache_timer = init_timer()}};
{add_rc_list, List} ->
@@ -1176,7 +1176,7 @@ handle_info(_Info, State) ->
-spec terminate(term(), state()) -> 'ok'.
terminate(_Reason, State) ->
- stop_timer(State#state.cache_timer),
+ _ = stop_timer(State#state.cache_timer),
ok.
%%%----------------------------------------------------------------------
@@ -1233,7 +1233,7 @@ do_add_host(Byname, Byaddr, Names, Type, IP) ->
ok.
do_del_host(Byname, Byaddr, IP) ->
- [ets:delete_object(Byname, NIP) || NIP <- ets:lookup(Byaddr, IP)],
+ _ = [ets:delete_object(Byname, NIP) || NIP <- ets:lookup(Byaddr, IP)],
ets:delete(Byaddr, IP),
ok.
diff --git a/lib/kernel/src/inet_gethost_native.erl b/lib/kernel/src/inet_gethost_native.erl
index df866660b4..4320987078 100644
--- a/lib/kernel/src/inet_gethost_native.erl
+++ b/lib/kernel/src/inet_gethost_native.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -237,7 +237,7 @@ handle_message({Port, {data, Data}}, State = #state{port = Port}) ->
State;
Req ->
lists:foreach(fun({P,R,TR}) ->
- ?CANCEL_TIMER(TR),
+ _= ?CANCEL_TIMER(TR),
P ! {R,
{ok,
BinReply}}
@@ -276,7 +276,7 @@ handle_message({timeout, Pid, RID}, State) ->
{last, {LP,LR,_}} ->
LP ! {LR, {error,timeout}},
%% Remove the whole request structure...
- pick_request(State, RID),
+ _ = pick_request(State, RID),
%% Also cancel the request to the port program...
(catch port_command(State#state.port,
<<RID:32,?OP_CANCEL_REQUEST>>))
@@ -517,7 +517,7 @@ do_start(Sup, C) ->
{error, {{already_started, Pid}, _Child}} when is_pid(Pid) ->
ok;
{error, already_present} ->
- supervisor:delete_child(Sup, Child),
+ _ = supervisor:delete_child(Sup, Child),
do_start(Sup, C)
end.
diff --git a/lib/kernel/src/inet_parse.erl b/lib/kernel/src/inet_parse.erl
index 619c78a6ca..d24bda0c3d 100644
--- a/lib/kernel/src/inet_parse.erl
+++ b/lib/kernel/src/inet_parse.erl
@@ -288,7 +288,7 @@ parse_file(_, File, Fn) ->
case file:open(File, [read]) of
{ok, Fd} ->
Result = parse_fd(File,Fd, 1, Fn, []),
- file:close(Fd),
+ _ = file:close(Fd),
Result;
Error -> Error
end.
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl
index 59ba408d7a..1a30979126 100644
--- a/lib/kernel/src/inet_res.erl
+++ b/lib/kernel/src/inet_res.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2011. 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
@@ -139,7 +139,7 @@ resolve(Name, Class, Type, Opts, Timeout) ->
{ok, Nm} ->
Timer = inet:start_timer(Timeout),
Res = res_query(Nm, Class, Type, Opts, Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res;
Error ->
Error
@@ -339,7 +339,7 @@ gethostbyaddr(IP) -> gethostbyaddr_tm(IP,false).
gethostbyaddr(IP,Timeout) ->
Timer = inet:start_timer(Timeout),
Res = gethostbyaddr_tm(IP,Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
gethostbyaddr_tm({A,B,C,D} = IP, Timer) when ?ip(A,B,C,D) ->
@@ -424,7 +424,7 @@ gethostbyname(Name,Family) ->
gethostbyname(Name,Family,Timeout) ->
Timer = inet:start_timer(Timeout),
Res = gethostbyname_tm(Name,Family,Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
gethostbyname_tm(Name,inet,Timer) ->
@@ -483,7 +483,7 @@ getbyname(Name, Type) ->
getbyname(Name, Type, Timeout) ->
Timer = inet:start_timer(Timeout),
Res = getbyname_tm(Name, Type, Timer),
- inet:stop_timer(Timer),
+ _ = inet:stop_timer(Timer),
Res.
getbyname_tm(Name, Type, Timer) when is_list(Name) ->
diff --git a/lib/kernel/src/inet_tcp_dist.erl b/lib/kernel/src/inet_tcp_dist.erl
index 8005eff58c..63f236b069 100644
--- a/lib/kernel/src/inet_tcp_dist.erl
+++ b/lib/kernel/src/inet_tcp_dist.erl
@@ -119,7 +119,7 @@ accept_loop(Kernel, Listen) ->
case inet_tcp:accept(Listen) of
{ok, Socket} ->
Kernel ! {accept,self(),Socket,inet,tcp},
- controller(Kernel, Socket),
+ _ = controller(Kernel, Socket),
accept_loop(Kernel, Listen);
Error ->
exit(Error)
diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl
index dd0071b914..0c70e5f125 100644
--- a/lib/kernel/src/net_kernel.erl
+++ b/lib/kernel/src/net_kernel.erl
@@ -320,7 +320,7 @@ passive_connect_monitor(Parent, Node) ->
Parent ! {self(), false};
{nodeup,Node,_} ->
monitor_nodes(false,[{node_type,all}]),
- erlang:cancel_timer(Tref),
+ _ = erlang:cancel_timer(Tref),
Parent ! {self(),true}
end
end.
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 742c000cc1..1f96e5c3c0 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -275,8 +275,8 @@ start_port_srv_handle({Ref,Client}) ->
error:Reason ->
{Reason,erlang:get_stacktrace()}
end,
- Client ! {Ref,Reply}.
-
+ Client ! {Ref,Reply},
+ ok.
start_port_srv_loop() ->
receive
@@ -284,7 +284,7 @@ start_port_srv_loop() ->
is_pid(Client) ->
start_port_srv_handle(Request);
_Junk ->
- ignore
+ ok
end,
start_port_srv_loop().
diff --git a/lib/kernel/src/pg2.erl b/lib/kernel/src/pg2.erl
index 1ff10eb303..2cfbcc9189 100644
--- a/lib/kernel/src/pg2.erl
+++ b/lib/kernel/src/pg2.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2012. 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
@@ -45,7 +45,7 @@ start() ->
-spec create(Name :: name()) -> 'ok'.
create(Name) ->
- ensure_started(),
+ _ = ensure_started(),
case ets:member(pg2_table, {group, Name}) of
false ->
global:trans({{?MODULE, Name}, self()},
@@ -60,7 +60,7 @@ create(Name) ->
-spec delete(Name :: name()) -> 'ok'.
delete(Name) ->
- ensure_started(),
+ _ = ensure_started(),
global:trans({{?MODULE, Name}, self()},
fun() ->
gen_server:multi_call(?MODULE, {delete, Name})
@@ -71,7 +71,7 @@ delete(Name) ->
when Name :: name().
join(Name, Pid) when is_pid(Pid) ->
- ensure_started(),
+ _ = ensure_started(),
case ets:member(pg2_table, {group, Name}) of
false ->
{error, {no_such_group, Name}};
@@ -88,7 +88,7 @@ join(Name, Pid) when is_pid(Pid) ->
when Name :: name().
leave(Name, Pid) when is_pid(Pid) ->
- ensure_started(),
+ _ = ensure_started(),
case ets:member(pg2_table, {group, Name}) of
false ->
{error, {no_such_group, Name}};
@@ -105,7 +105,7 @@ leave(Name, Pid) when is_pid(Pid) ->
when Name :: name().
get_members(Name) ->
- ensure_started(),
+ _ = ensure_started(),
case ets:member(pg2_table, {group, Name}) of
true ->
group_members(Name);
@@ -117,7 +117,7 @@ get_members(Name) ->
when Name :: name().
get_local_members(Name) ->
- ensure_started(),
+ _ = ensure_started(),
case ets:member(pg2_table, {group, Name}) of
true ->
local_group_members(Name);
@@ -128,7 +128,7 @@ get_local_members(Name) ->
-spec which_groups() -> [Name :: name()].
which_groups() ->
- ensure_started(),
+ _ = ensure_started(),
all_groups().
-spec get_closest_pid(Name) -> pid() | {'error', Reason} when
@@ -283,7 +283,7 @@ member_died(Ref) ->
join_group(Name, Pid) ->
Ref_Pid = {ref, Pid},
- try _ = ets:update_counter(pg2_table, Ref_Pid, {4, +1})
+ try _ = ets:update_counter(pg2_table, Ref_Pid, {4, +1}), true
catch _:_ ->
{RPid, Ref} = do_monitor(Pid),
true = ets:insert(pg2_table, {Ref_Pid, RPid, Ref, 1}),
diff --git a/lib/kernel/src/rpc.erl b/lib/kernel/src/rpc.erl
index 83e0b59cc2..78fec2aa2b 100644
--- a/lib/kernel/src/rpc.erl
+++ b/lib/kernel/src/rpc.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -158,20 +158,20 @@ handle_info({Caller, {reply, Reply}}, S) ->
{noreply, S}
end;
handle_info({From, {sbcast, Name, Msg}}, S) ->
- case catch Name ! Msg of %% use catch to get the printout
- {'EXIT', _} ->
- From ! {?NAME, node(), {nonexisting_name, Name}};
- _ ->
- From ! {?NAME, node(), node()}
- end,
+ _ = case catch Name ! Msg of %% use catch to get the printout
+ {'EXIT', _} ->
+ From ! {?NAME, node(), {nonexisting_name, Name}};
+ _ ->
+ From ! {?NAME, node(), node()}
+ end,
{noreply, S};
handle_info({From, {send, Name, Msg}}, S) ->
- case catch Name ! {From, Msg} of %% use catch to get the printout
- {'EXIT', _} ->
- From ! {?NAME, node(), {nonexisting_name, Name}};
- _ ->
- ok %% It's up to Name to respond !!!!!
- end,
+ _ = case catch Name ! {From, Msg} of %% use catch to get the printout
+ {'EXIT', _} ->
+ From ! {?NAME, node(), {nonexisting_name, Name}};
+ _ ->
+ ok %% It's up to Name to respond !!!!!
+ end,
{noreply, S};
handle_info({From, {call,Mod,Fun,Args,Gleader}}, S) ->
%% Special for hidden C node's, uugh ...
@@ -423,7 +423,7 @@ abcast(Name, Mess) ->
abcast([Node|Tail], Name, Mess) ->
Dest = {Name,Node},
case catch erlang:send(Dest, Mess, [noconnect]) of
- noconnect -> spawn(erlang, send, [Dest,Mess]);
+ noconnect -> spawn(erlang, send, [Dest,Mess]), ok;
_ -> ok
end,
abcast(Tail, Name, Mess);
diff --git a/lib/kernel/src/standard_error.erl b/lib/kernel/src/standard_error.erl
index e41dcd01fc..10cf77e0d4 100644
--- a/lib/kernel/src/standard_error.erl
+++ b/lib/kernel/src/standard_error.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2009-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
@@ -69,7 +69,7 @@ run(P) ->
server_loop(Port) ->
receive
{io_request,From,ReplyAs,Request} when is_pid(From) ->
- do_io_request(Request, From, ReplyAs, Port),
+ _ = do_io_request(Request, From, ReplyAs, Port),
server_loop(Port);
{'EXIT',Port,badsig} -> % Ignore badsig errors
server_loop(Port);
@@ -175,7 +175,7 @@ io_reply(From, ReplyAs, Reply) ->
%% put_chars
put_chars(Chars, Port) when is_binary(Chars) ->
- put_port(Chars, Port),
+ _ = put_port(Chars, Port),
{ok,ok};
put_chars(Chars, Port) ->
case catch list_to_binary(Chars) of
diff --git a/lib/kernel/src/user.erl b/lib/kernel/src/user.erl
index c897d46bc2..40376ef752 100644
--- a/lib/kernel/src/user.erl
+++ b/lib/kernel/src/user.erl
@@ -103,11 +103,11 @@ catch_loop(Port, Shell, Q) ->
{unknown_exit,{Shell,Reason},_} -> % shell has exited
case Reason of
normal ->
- put_chars("*** ", Port, []);
+ put_port(<<"*** ">>, Port);
_ ->
- put_chars("*** ERROR: ", Port, [])
+ put_port(<<"*** ERROR: ">>, Port)
end,
- put_chars("Shell process terminated! ***\n", Port, []),
+ put_port(<<"Shell process terminated! ***\n">>, Port),
catch_loop(Port, start_new_shell());
{unknown_exit,_,Q1} ->
catch_loop(Port, Shell, Q1);
@@ -181,7 +181,7 @@ get_fd_geometry(Port) ->
do_io_request(Req, From, ReplyAs, Port, Q0) ->
case io_request(Req, Port, Q0) of
{_Status,Reply,Q1} ->
- io_reply(From, ReplyAs, Reply),
+ _ = io_reply(From, ReplyAs, Reply),
Q1;
{exit,What} ->
ok = send_port(Port, close),
diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl
index bb654495d3..6544426a54 100644
--- a/lib/kernel/src/user_drv.erl
+++ b/lib/kernel/src/user_drv.erl
@@ -488,21 +488,19 @@ set_unicode_state(Iport, Bool) ->
%% io_request(Request, InPort, OutPort)
%% io_requests(Requests, InPort, OutPort)
-
-io_request({put_chars, unicode,Cs}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]}};
-io_request({move_rel,N}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_MOVE|put_int16(N, [])]}};
-io_request({insert_chars,unicode,Cs}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]}};
-io_request({delete_chars,N}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_DELC|put_int16(N, [])]}};
-io_request(beep, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_BEEP]}};
-io_request({requests,Rs}, Iport, Oport) ->
- io_requests(Rs, Iport, Oport);
-io_request(_R, _Iport, _Oport) ->
- ok.
+%% Note: InPort is unused.
+
+io_request(Request, Iport, Oport) ->
+ try io_command(Request) of
+ Command ->
+ Oport ! {self(),Command},
+ ok
+ catch
+ {requests,Rs} ->
+ io_requests(Rs, Iport, Oport);
+ _ ->
+ ok
+ end.
io_requests([R|Rs], Iport, Oport) ->
io_request(R, Iport, Oport),
@@ -513,6 +511,19 @@ io_requests([], _Iport, _Oport) ->
put_int16(N, Tail) ->
[(N bsr 8)band 255,N band 255|Tail].
+io_command({put_chars, unicode,Cs}) ->
+ {command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]};
+io_command({move_rel,N}) ->
+ {command,[?OP_MOVE|put_int16(N, [])]};
+io_command({insert_chars,unicode,Cs}) ->
+ {command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]};
+io_command({delete_chars,N}) ->
+ {command,[?OP_DELC|put_int16(N, [])]};
+io_command(beep) ->
+ {command,[?OP_BEEP]};
+io_command(Else) ->
+ throw(Else).
+
%% gr_new()
%% gr_get_num(Group, Index)
%% gr_get_info(Group, Pid)
diff --git a/lib/kernel/src/wrap_log_reader.erl b/lib/kernel/src/wrap_log_reader.erl
index 689269fc28..7e1f4aa07f 100644
--- a/lib/kernel/src/wrap_log_reader.erl
+++ b/lib/kernel/src/wrap_log_reader.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1998-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
@@ -149,7 +149,7 @@ open_int(File, FileNo, FirstFileNo) ->
{ok, Head} ->
case disk_log_1:is_head(Head) of
no ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {not_a_log_file, FName}};
_ -> % yes or yes_not_closed
case last_mod_time(FName) of
@@ -161,12 +161,12 @@ open_int(File, FileNo, FirstFileNo) ->
first_no = FirstFileNo},
{ok, WR};
{error, E} ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {file_error, FName, E}}
end
end;
_Other ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {not_a_log_file, FName}}
end;
_Other ->
@@ -280,7 +280,7 @@ read_next_file(WR, N, NewFileNo, Bad) ->
true ->
case open_int(File, NewFileNo, FirstFileNo) of
{ok, NWR} ->
- close(WR), %% Now we can safely close the old file.
+ _ = close(WR), %% Now we can safely close the old file.
chunk(NWR, N, Bad);
Error ->
Error
diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl
index fe7e0f8e60..7a93fa0f45 100644
--- a/lib/stdlib/src/beam_lib.erl
+++ b/lib/stdlib/src/beam_lib.erl
@@ -904,7 +904,7 @@ call_crypto_server(Req) ->
end.
call_crypto_server_1(Req) ->
- gen_server:start({local,?CRYPTO_KEY_SERVER}, ?MODULE, [], []),
+ {ok, _} = gen_server:start({local,?CRYPTO_KEY_SERVER}, ?MODULE, [], []),
erlang:yield(),
call_crypto_server(Req).
diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl
index 91d317489c..56d435d5d7 100644
--- a/lib/stdlib/src/c.erl
+++ b/lib/stdlib/src/c.erl
@@ -694,7 +694,7 @@ pwd() ->
Dir :: file:name().
cd(Dir) ->
- file:set_cwd(Dir),
+ _ = file:set_cwd(Dir),
pwd().
%% ls()
diff --git a/lib/stdlib/src/dets.erl b/lib/stdlib/src/dets.erl
index 50812cc532..d743467e97 100644
--- a/lib/stdlib/src/dets.erl
+++ b/lib/stdlib/src/dets.erl
@@ -469,7 +469,7 @@ is_compatible_bchunk_format(Tab, Term) ->
is_dets_file(FileName) ->
case catch read_file_header(FileName, read, false) of
{ok, Fd, FH} ->
- file:close(Fd),
+ _ = file:close(Fd),
FH#fileheader.cookie =:= ?MAGIC;
{error, {tooshort, _}} ->
false;
@@ -1384,7 +1384,8 @@ do_apply_op(Op, From, Head, N) ->
end,
if
From =/= self() ->
- From ! {self(), {error, {dets_bug, Name, Op, Bad}}};
+ From ! {self(), {error, {dets_bug, Name, Op, Bad}}},
+ ok;
true -> % auto_save | may_grow | {delayed_write, _}
ok
end,
@@ -1634,7 +1635,8 @@ start_auto_save_timer(Head) when Head#head.auto_save =:= infinity ->
ok;
start_auto_save_timer(Head) ->
Millis = Head#head.auto_save,
- erlang:send_after(Millis, self(), ?DETS_CALL(self(), auto_save)).
+ _Ref = erlang:send_after(Millis, self(), ?DETS_CALL(self(), auto_save)),
+ ok.
%% Version 9: Peek the message queue and try to evaluate several
%% lookup requests in parallel. Evalute delete_object, delete and
@@ -1683,7 +1685,7 @@ stream_end(Head, Pids0, C, N, Next) ->
%% replies to delete and insert requests even if the
%% latter requests were made before the lookup requests,
%% which can be confusing.)
- lookup_replies(Found),
+ _ = lookup_replies(Found),
stream_end1(Pids0, Next, N, C, Head1, PwriteList);
Head1 when is_record(Head1, head) ->
stream_end2(Pids0, Pids0, Next, N, C, Head1, ok);
@@ -1733,7 +1735,7 @@ lookup_replies(Q) ->
lookup_replies(P, O, []) ->
lookup_reply(P, O);
lookup_replies(P, O, [{P2,O2} | L]) ->
- lookup_reply(P, O),
+ _ = lookup_reply(P, O),
lookup_replies(P2, lists:append(O2), L).
%% If a list of Pid then op was {member, Key}. Inlined.
@@ -1790,12 +1792,15 @@ fclose(Head) ->
{Head1, Res} = perform_save(Head, false),
case Head1#head.ram_file of
true ->
- ignore;
+ Res;
false ->
dets_utils:stop_disk_map(),
- file:close(Head1#head.fptr)
- end,
- Res.
+ Res2 = file:close(Head1#head.fptr),
+ if
+ Res2 =:= ok -> Res;
+ true -> Res2
+ end
+ end.
%% -> {NewHead, Res}
perform_save(Head, DoSync) when Head#head.update_mode =:= dirty;
@@ -2002,7 +2007,7 @@ remove_fix(Head, Pid, How) ->
end.
do_stop(Head) ->
- unlink_fixing_procs(Head),
+ _NewHead = unlink_fixing_procs(Head),
fclose(Head).
unlink_fixing_procs(Head) ->
@@ -2010,7 +2015,7 @@ unlink_fixing_procs(Head) ->
false ->
Head;
{_, Counters} ->
- lists:map(fun({Pid, _Counter}) -> unlink(Pid) end, Counters),
+ lists:foreach(fun({Pid, _Counter}) -> unlink(Pid) end, Counters),
Head#head{fixed = false,
freelists = dets_utils:get_freelists(Head)}
end.
@@ -2021,8 +2026,9 @@ check_growth(Head) ->
NoThings = no_things(Head),
if
NoThings > Head#head.next ->
- erlang:send_after(200, self(),
- ?DETS_CALL(self(), may_grow)); % Catch up.
+ _Ref = erlang:send_after
+ (200, self(), ?DETS_CALL(self(), may_grow)), % Catch up.
+ ok;
true ->
ok
end.
@@ -2123,7 +2129,7 @@ do_open_file([Fname, Verbose], Parent, Server, Ref) ->
do_open_file([Tab, OpenArgs, Verb], Parent, Server, Ref) ->
case catch fopen3(Tab, OpenArgs) of
{error, {tooshort, _}} ->
- file:delete(OpenArgs#open_args.file),
+ _ = file:delete(OpenArgs#open_args.file),
do_open_file([Tab, OpenArgs, Verb], Parent, Server, Ref);
{error, _Reason} = Error ->
err(Error);
@@ -2671,11 +2677,11 @@ fopen_init_file(Tab, OpenArgs) ->
case catch Mod:initiate_file(Fd, Tab, Fname, Type, Kp, MinSlots, MaxSlots,
Ram, CacheSz, Auto, true) of
{error, Reason} when Ram ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, Reason});
{error, Reason} ->
- file:close(Fd),
- file:delete(Fname),
+ _ = file:close(Fd),
+ _ = file:delete(Fname),
throw({error, Reason});
{ok, Head} ->
start_auto_save_timer(Head),
@@ -2730,8 +2736,8 @@ compact(SourceHead) ->
{ok, H} ->
H;
Error ->
- file:close(Fd),
- file:delete(Tmp),
+ _ = file:close(Fd),
+ _ = file:delete(Tmp),
throw(Error)
end,
@@ -2748,12 +2754,12 @@ compact(SourceHead) ->
if
R =:= ok -> ok;
true ->
- file:delete(Tmp),
+ _ = file:delete(Tmp),
throw(R)
end;
Err ->
- file:close(Fd),
- file:delete(Tmp),
+ _ = file:close(Fd),
+ _ = file:delete(Tmp),
throw(Err)
end.
@@ -2777,7 +2783,7 @@ fsck(Fd, Tab, Fname, FH, MinSlotsArg, MaxSlotsArg, Version) ->
BetterSlotNumbers = {MinSlots, BetterNoSlots, MaxSlots},
case fsck_try(Fd, Tab, FH, Fname, BetterSlotNumbers, Version) of
{try_again, _} ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {cannot_repair, Fname}};
Else ->
Else
@@ -2818,15 +2824,15 @@ fsck_try(Fd, Tab, FH, Fname, SlotNumbers, Version) ->
if
R =:= ok -> ok;
true ->
- file:delete(Tmp),
+ _ = file:delete(Tmp),
R
end;
TryAgainOrError ->
- file:delete(Tmp),
+ _ = file:delete(Tmp),
TryAgainOrError
end;
Error ->
- file:close(Fd),
+ _ = file:close(Fd),
Error
end.
@@ -2855,13 +2861,13 @@ fsck_try_est(Head, Fd, Fname, SlotNumbers, FH) ->
Bulk = false,
case Reply of
{ok, NoDups, H1} ->
- file:close(Fd),
+ _ = file:close(Fd),
fsck_copy(SizeData, H1, Bulk, NoDups);
{try_again, _} = Return ->
close_files(Bulk, SizeData, Head),
Return;
Else ->
- file:close(Fd),
+ _ = file:close(Fd),
close_files(Bulk, SizeData, Head),
Else
end.
@@ -2896,14 +2902,20 @@ fsck_copy1([SzData | L], Head, Bulk, NoDups) ->
{LogSz, Pos, {FileName, Fd}, NoObjects} = SzData,
Size = if NoObjects =:= 0 -> 0; true -> ?POW(LogSz-1) end,
ExpectedSize = Size * NoObjects,
- close_tmp(Fd),
- case file:position(Out, Pos) of
- {ok, Pos} -> ok;
- PError -> dets_utils:file_error(FileName, PError)
+ case close_tmp(Fd) of
+ ok -> ok;
+ Err ->
+ close_files(Bulk, L, Head),
+ dets_utils:file_error(FileName, Err)
end,
- {ok, Pos} = file:position(Out, Pos),
+ case file:position(Out, Pos) of
+ {ok, Pos} -> ok;
+ Err2 ->
+ close_files(Bulk, L, Head),
+ dets_utils:file_error(Head#head.filename, Err2)
+ end,
CR = file:copy({FileName, [raw,binary]}, Out),
- file:delete(FileName),
+ _ = file:delete(FileName),
case CR of
{ok, Copied} when Copied =:= ExpectedSize;
NoObjects =:= 0 -> % the segments
@@ -2937,11 +2949,11 @@ free_n_objects(Head, Addr, Size, N) ->
free_n_objects(NewHead, NewAddr, Size, N-1).
close_files(false, SizeData, Head) ->
- file:close(Head#head.fptr),
+ _ = file:close(Head#head.fptr),
close_files(true, SizeData, Head);
close_files(true, SizeData, _Head) ->
Fun = fun({_Size, _Pos, {FileName, Fd}, _No}) ->
- close_tmp(Fd),
+ _ = close_tmp(Fd),
file:delete(FileName);
(_) ->
ok
@@ -3261,7 +3273,7 @@ err(Error) ->
file_info(FileName) ->
case catch read_file_header(FileName, read, false) of
{ok, Fd, FH} ->
- file:close(Fd),
+ _ = file:close(Fd),
(FH#fileheader.mod):file_info(FH);
Other ->
Other
@@ -3290,7 +3302,7 @@ view(FileName) ->
X ->
X
end
- after file:close(Fd)
+ after _ = file:close(Fd)
end;
X ->
X
diff --git a/lib/stdlib/src/dets_server.erl b/lib/stdlib/src/dets_server.erl
index 931112088e..268c201047 100644
--- a/lib/stdlib/src/dets_server.erl
+++ b/lib/stdlib/src/dets_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2001-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
@@ -241,8 +241,8 @@ ensure_started() ->
init() ->
set_verbose(verbose_flag()),
process_flag(trap_exit, true),
- ets:new(?REGISTRY, [set, named_table]),
- ets:new(?OWNERS, [set, named_table]),
+ ?REGISTRY = ets:new(?REGISTRY, [set, named_table]),
+ ?OWNERS = ets:new(?OWNERS, [set, named_table]),
ets:new(?STORE, [duplicate_bag]).
verbose_flag() ->
@@ -338,7 +338,7 @@ handle_close(State, Req, {FromPid,_Tag}=From, Tab) ->
[{Tab, _Counter, Pid}] ->
do_unlink(Store, FromPid),
true = ets:match_delete(Store, {FromPid, Tab}),
- [true = ets:insert(Store, K) || K <- Keep],
+ true = ets:insert(Store, Keep),
ets:update_counter(?REGISTRY, Tab, -1),
pending_call(Tab, Pid, make_ref(), From, [],
remove_user, State)
diff --git a/lib/stdlib/src/dets_utils.erl b/lib/stdlib/src/dets_utils.erl
index 7bbb34dd15..6c176ad513 100644
--- a/lib/stdlib/src/dets_utils.erl
+++ b/lib/stdlib/src/dets_utils.erl
@@ -230,8 +230,12 @@ write_file(Head, Bin) ->
{ok, Fd} ->
R1 = file:write(Fd, Bin),
R2 = file:sync(Fd),
- file:close(Fd),
- if R1 =:= ok -> R2; true -> R1 end;
+ R3 = file:close(Fd),
+ case {R1, R2, R3} of
+ {ok, ok, R3} -> R3;
+ {ok, R2, _} -> R2;
+ {R1, _, _} -> R1
+ end;
Else ->
Else
end,
@@ -277,12 +281,7 @@ open(FileSpec, Args) ->
end.
truncate(Fd, FileName, Pos) ->
- if
- Pos =:= cur ->
- ok;
- true ->
- position(Fd, FileName, Pos)
- end,
+ _ = [position(Fd, FileName, Pos) || Pos =/= cur],
case file:truncate(Fd) of
ok ->
ok;
@@ -327,10 +326,10 @@ pread_close(Fd, FileName, Pos, Size) ->
{error, Error} ->
file_error_close(Fd, FileName, {error, Error});
{ok, Bin} when byte_size(Bin) < Size ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {tooshort, FileName}});
eof ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {tooshort, FileName}});
OK -> OK
end.
@@ -339,7 +338,7 @@ file_error(FileName, {error, Reason}) ->
throw({error, {file_error, FileName, Reason}}).
file_error_close(Fd, FileName, {error, Reason}) ->
- file:close(Fd),
+ _ = file:close(Fd),
throw({error, {file_error, FileName, Reason}}).
debug_mode() ->
@@ -977,7 +976,8 @@ dm([{P,<<Sz:32,X:32>>} | Bs], T) ->
true = ets:insert(T, {P,{pointer,X,Sz}}),
if
Sz =:= 0 ->
- X = 0;
+ X = 0,
+ true;
true ->
true = ets:insert(T, {{pointer,X}, P})
end,
diff --git a/lib/stdlib/src/dets_v8.erl b/lib/stdlib/src/dets_v8.erl
index 24d6e06ec8..f188502017 100644
--- a/lib/stdlib/src/dets_v8.erl
+++ b/lib/stdlib/src/dets_v8.erl
@@ -199,10 +199,10 @@
%% -> ok | throw({NewHead,Error})
mark_dirty(Head) ->
Dirty = [{?CLOSED_PROPERLY_POS, <<?NOT_PROPERLY_CLOSED:32>>}],
- dets_utils:pwrite(Head, Dirty),
- dets_utils:sync(Head),
- dets_utils:position(Head, Head#head.freelists_p),
- dets_utils:truncate(Head, cur).
+ {_NewHead, ok} = dets_utils:pwrite(Head, Dirty),
+ ok = dets_utils:sync(Head),
+ {ok, _Pos} = dets_utils:position(Head, Head#head.freelists_p),
+ ok = dets_utils:truncate(Head, cur).
%% -> {ok, head()} | throw(Error)
initiate_file(Fd, Tab, Fname, Type, Kp, MinSlots, MaxSlots,
diff --git a/lib/stdlib/src/dets_v9.erl b/lib/stdlib/src/dets_v9.erl
index 308f81c23b..2af93ec800 100644
--- a/lib/stdlib/src/dets_v9.erl
+++ b/lib/stdlib/src/dets_v9.erl
@@ -284,9 +284,9 @@
%% -> ok | throw({NewHead,Error})
mark_dirty(Head) ->
Dirty = [{?CLOSED_PROPERLY_POS, <<?NOT_PROPERLY_CLOSED:32>>}],
- dets_utils:pwrite(Head, Dirty),
- dets_utils:sync(Head),
- dets_utils:position(Head, Head#head.freelists_p),
+ {_H, ok} = dets_utils:pwrite(Head, Dirty),
+ ok = dets_utils:sync(Head),
+ {ok, _Pos} = dets_utils:position(Head, Head#head.freelists_p),
dets_utils:truncate(Head, cur).
%% -> {ok, head()} | throw(Error) | throw(badarg)
@@ -1385,13 +1385,13 @@ segment_file(SizeT, Head, FileData, SegEnd) ->
case Data of
{InFile,In0} ->
{OutFile, Out} = temp_file(Head, SizeT, I),
- file:close(In0),
+ _ = file:close(In0),
{ok, In} = dets_utils:open(InFile, [raw,binary,read]),
{ok, 0} = dets_utils:position(In, InFile, bof),
seg_file(SegAddr, SegAddr, In, InFile, Out, OutFile, SizeT,
SegEnd),
- file:close(In),
- file:delete(InFile),
+ _ = file:close(In),
+ _ = file:delete(InFile),
{OutFile,Out};
Objects ->
{LastAddr, B} = seg_file(Objects, SegAddr, SegAddr, SizeT, []),
@@ -1702,7 +1702,7 @@ free_list_to_file(Ftab, H, Pos, Sz, Ws, WsSz) ->
free_list_to_file(Ftab, H, Pos+1, Sz, NWs, NWsSz).
free_lists_from_file(H, Pos) ->
- dets_utils:position(H#head.fptr, H#head.filename, Pos),
+ {ok, Pos} = dets_utils:position(H#head.fptr, H#head.filename, Pos),
FL = dets_utils:empty_free_lists(),
case catch bin_to_tree([], H, start, FL, -1, []) of
{'EXIT', _} ->
diff --git a/lib/stdlib/src/digraph_utils.erl b/lib/stdlib/src/digraph_utils.erl
index 807b5c12a1..0e248df453 100644
--- a/lib/stdlib/src/digraph_utils.erl
+++ b/lib/stdlib/src/digraph_utils.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1999-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
@@ -370,5 +370,5 @@ condense('$end_of_table', _T, _SC, _G, _SCG, _I2C) ->
condense(I, T, SC, G, SCG, I2C) ->
[{_,C}] = ets:lookup(I2C, I),
digraph:add_vertex(SCG, C),
- [digraph:add_edge(SCG, SC, C) || C =/= SC],
+ _ = [digraph:add_edge(SCG, SC, C) || C =/= SC],
condense(ets:next(T, I), T, SC, G, SCG, I2C).
diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl
index 5bd6a224a2..dd0512be4d 100644
--- a/lib/stdlib/src/epp.erl
+++ b/lib/stdlib/src/epp.erl
@@ -644,7 +644,7 @@ leave_file(From, St) ->
enter_file_reply(From, OldName, CurrLoc, CurrLoc),
case OldName2 =:= OldName of
true ->
- From;
+ ok;
false ->
NFrom = wait_request(NextSt),
enter_file_reply(NFrom, OldName2, OldLoc,
diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl
index 4b654833ed..f49c2a64f4 100644
--- a/lib/stdlib/src/erl_tar.erl
+++ b/lib/stdlib/src/erl_tar.erl
@@ -45,10 +45,7 @@ open(Name, Mode) ->
open1({binary,Bin}, read, _Raw, Opts) ->
case file:open(Bin, [ram,binary,read]) of
{ok,File} ->
- case Opts of
- [compressed] -> ram_file:uncompress(File);
- [] -> ok
- end,
+ _ = [ram_file:uncompress(File) || Opts =:= [compressed]],
{ok,{read,File}};
Error ->
Error
diff --git a/lib/stdlib/src/error_logger_tty_h.erl b/lib/stdlib/src/error_logger_tty_h.erl
index ad5891f191..e92142d154 100644
--- a/lib/stdlib/src/error_logger_tty_h.erl
+++ b/lib/stdlib/src/error_logger_tty_h.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -54,7 +54,7 @@ init([]) ->
handle_event({_Type, GL, _Msg}, State) when node(GL) =/= node() ->
{ok, State};
handle_event(Event, State) ->
- write_event(tag_event(Event),io),
+ ok = write_event(tag_event(Event),io),
{ok, State}.
handle_info({'EXIT', User, _Reason}, {User, PrevHandler}) ->
@@ -66,10 +66,10 @@ handle_info({'EXIT', User, _Reason}, {User, PrevHandler}) ->
PrevHandler, go_back}
end;
handle_info({emulator, GL, Chars}, State) when node(GL) == node() ->
- write_event(tag_event({emulator, GL, Chars}),io),
+ ok = write_event(tag_event({emulator, GL, Chars}),io),
{ok, State};
handle_info({emulator, noproc, Chars}, State) ->
- write_event(tag_event({emulator, noproc, Chars}),io),
+ ok = write_event(tag_event({emulator, noproc, Chars}),io),
{ok, State};
handle_info(_, State) ->
{ok, State}.
@@ -99,10 +99,11 @@ set_group_leader() ->
tag_event(Event) ->
{erlang:universaltime(), Event}.
+%% IOMOd is always 'io'
write_events(Events,IOMod) -> write_events1(lists:reverse(Events),IOMod).
write_events1([Event|Es],IOMod) ->
- write_event(Event,IOMod),
+ ok = write_event(Event,IOMod),
write_events1(Es,IOMod);
write_events1([],_IOMod) ->
ok.
diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl
index fea718541d..35f6dff57e 100644
--- a/lib/stdlib/src/escript.erl
+++ b/lib/stdlib/src/escript.erl
@@ -771,9 +771,11 @@ interpret(Forms, HasRecs, File, Args) ->
ArgsA = erl_parse:abstract(Args, 0),
Call = {call,0,{atom,0,main},[ArgsA]},
try
- erl_eval:expr(Call,
- erl_eval:new_bindings(),
- {value,fun(I, J) -> code_handler(I, J, Dict, File) end}),
+ _ = erl_eval:expr(Call,
+ erl_eval:new_bindings(),
+ {value,fun(I, J) ->
+ code_handler(I, J, Dict, File)
+ end}),
my_halt(0)
catch
Class:Reason ->
diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl
index 77c8029f59..87e6502668 100644
--- a/lib/stdlib/src/ets.erl
+++ b/lib/stdlib/src/ets.erl
@@ -719,7 +719,7 @@ tab2file(Tab, File) ->
tab2file(Tab, File, Options) ->
try
{ok, FtOptions} = parse_ft_options(Options),
- file:delete(File),
+ _ = file:delete(File),
case file:read_file_info(File) of
{error, enoent} -> ok;
_ -> throw(eaccess)
@@ -750,14 +750,18 @@ tab2file(Tab, File, Options) ->
{fun(Oldstate,Termlist) ->
{NewState,BinList} =
md5terms(Oldstate,Termlist),
- disk_log:blog_terms(Name,BinList),
- NewState
+ case disk_log:blog_terms(Name,BinList) of
+ ok -> NewState;
+ {error, Reason2} -> throw(Reason2)
+ end
end,
erlang:md5_init()};
false ->
{fun(_,Termlist) ->
- disk_log:log_terms(Name,Termlist),
- true
+ case disk_log:log_terms(Name,Termlist) of
+ ok -> true;
+ {error, Reason2} -> throw(Reason2)
+ end
end,
true}
end,
@@ -792,16 +796,16 @@ tab2file(Tab, File, Options) ->
disk_log:close(Name)
catch
throw:TReason ->
- disk_log:close(Name),
- file:delete(File),
+ _ = disk_log:close(Name),
+ _ = file:delete(File),
throw(TReason);
exit:ExReason ->
- disk_log:close(Name),
- file:delete(File),
+ _ = disk_log:close(Name),
+ _ = file:delete(File),
exit(ExReason);
error:ErReason ->
- disk_log:close(Name),
- file:delete(File),
+ _ = disk_log:close(Name),
+ _ = file:delete(File),
erlang:raise(error,ErReason,erlang:get_stacktrace())
end
catch
@@ -901,7 +905,7 @@ file2tab(File, Opts) ->
{repaired, Name, _,_} -> %Uh? cannot happen?
case Verify of
true ->
- disk_log:close(Name),
+ _ = disk_log:close(Name),
throw(badfile);
false ->
get_header_data(Name,Verify)
@@ -1306,7 +1310,10 @@ tabfile_info(File) when is_list(File) ; is_atom(File) ->
Other2 ->
throw(Other2)
end,
- disk_log:close(Name),
+ case disk_log:close(Name) of
+ ok -> ok;
+ {error, Reason} -> throw(Reason)
+ end,
{value, N} = lists:keysearch(name, 1, FullHeader),
{value, Type} = lists:keysearch(type, 1, FullHeader),
{value, P} = lists:keysearch(protection, 1, FullHeader),
diff --git a/lib/stdlib/src/file_sorter.erl b/lib/stdlib/src/file_sorter.erl
index 2bf88959b7..687d72b4bd 100644
--- a/lib/stdlib/src/file_sorter.erl
+++ b/lib/stdlib/src/file_sorter.erl
@@ -547,7 +547,7 @@ files(_I, L, _LSz, #w{seq = 1, out = Out}=W, []) ->
NW = close_input(W1),
outfun(close, NW);
Out ->
- write_run(L, W, Out),
+ _ = write_run(L, W, Out),
ok
end;
files(_I, L, _LSz, W, []) ->
@@ -638,7 +638,7 @@ last_merge(R, W) when length(R) =< W#w.no_files ->
NW = close_input(W2),
outfun(close, NW);
Out ->
- merge_files(R, W, Out),
+ _ = merge_files(R, W, Out),
ok
end;
last_merge(R, W) ->
@@ -1110,10 +1110,12 @@ read_fun2(Fd, Bin, Size, FileName, Owner) ->
end.
close_read_fun(Fd, _FileName, user) ->
- file:close(Fd);
+ _ = file:close(Fd),
+ ok;
close_read_fun(Fd, FileName, fsort) ->
- file:close(Fd),
- file:delete(FileName).
+ _ = file:close(Fd),
+ _ = file:delete(FileName),
+ ok.
read_objs(Fd, FileName, I, L, Bin0, Size0, LSz, W) ->
Max = erlang:max(Size0, ?CHUNKSIZE),
@@ -1481,10 +1483,10 @@ cleanup(W) ->
F = fun(IFun) when is_function(IFun) ->
IFun(close);
({Fd,FileName}) ->
- file:close(Fd),
- file:delete(FileName);
+ _ = file:close(Fd),
+ _= file:delete(FileName);
(FileName) ->
- file:delete(FileName)
+ _= file:delete(FileName)
end,
lists:foreach(F, W1#w.temp).
@@ -1502,8 +1504,12 @@ close_out(_) ->
close_file(Fd, W) ->
{Fd, FileName} = lists:keyfind(Fd, 1, W#w.temp),
?DEBUG("closing ~tp~n", [FileName]),
- file:close(Fd),
- W#w{temp = [FileName | lists:keydelete(Fd, 1, W#w.temp)]}.
+ case file:close(Fd) of
+ ok ->
+ W#w{temp = [FileName | lists:keydelete(Fd, 1, W#w.temp)]};
+ Error ->
+ file_error(FileName, Error, W)
+ end.
%%%
%%% Format 'term'.
@@ -1536,10 +1542,10 @@ file_rterms2(Fd, L, LSz, FileName, Files) when LSz < ?CHUNKSIZE ->
B = term_to_binary(Term),
file_rterms2(Fd, [B | L], LSz + byte_size(B), FileName, Files);
eof ->
- file:close(Fd),
+ _ = file:close(Fd),
{lists:reverse(L), file_rterms(no_file, Files)};
_Error ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {bad_term, FileName}}
end;
file_rterms2(Fd, L, _LSz, FileName, Files) ->
@@ -1568,7 +1574,7 @@ write_terms(Fd, F, [B | Bs], Args) ->
ok ->
write_terms(Fd, F, Bs, Args);
{error, Reason} ->
- file:close(Fd),
+ _ = file:close(Fd),
{error, {file_error, F, Reason}}
end;
write_terms(Fd, F, [], Args) ->
diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl
index 42ef3679a2..42885bcdcf 100644
--- a/lib/stdlib/src/filelib.erl
+++ b/lib/stdlib/src/filelib.erl
@@ -231,7 +231,7 @@ ensure_dir(F) ->
%% Protect against infinite loop
{error,einval};
false ->
- ensure_dir(Dir),
+ _ = ensure_dir(Dir),
case file:make_dir(Dir) of
{error,eexist}=EExist ->
case do_is_dir(Dir, file) of
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index d9411e58cf..e9654322f1 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -549,7 +549,7 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod, _Time, Debug) ->
{stop, Reason, Reply, NStateData} when From =/= undefined ->
{'EXIT', R} = (catch terminate(Reason, Name, Msg, Mod,
StateName, NStateData, Debug)),
- reply(Name, From, Reply, Debug, StateName),
+ _ = reply(Name, From, Reply, Debug, StateName),
exit(R);
{'EXIT', What} ->
terminate(What, Name, Msg, Mod, StateName, StateData, Debug);
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl
index 30a81ade49..4a16ed120f 100644
--- a/lib/stdlib/src/gen_server.erl
+++ b/lib/stdlib/src/gen_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -623,7 +623,7 @@ handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod, Debug) ->
{stop, Reason, Reply, NState} ->
{'EXIT', R} =
(catch terminate(Reason, Name, Msg, Mod, NState, Debug)),
- reply(Name, From, Reply, NState, Debug),
+ _ = reply(Name, From, Reply, NState, Debug),
exit(R);
Other ->
handle_common_reply(Other, Parent, Name, Msg, Mod, State, Debug)
diff --git a/lib/stdlib/src/log_mf_h.erl b/lib/stdlib/src/log_mf_h.erl
index 19b555a48c..6b42363979 100644
--- a/lib/stdlib/src/log_mf_h.erl
+++ b/lib/stdlib/src/log_mf_h.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -135,7 +135,12 @@ handle_event(Event, State) ->
State#state{cur_fd = NewFd, curF = NewF, curB = 0}
end,
[Hi,Lo] = put_int16(Size),
- file:write(NewState#state.cur_fd, [Hi, Lo, Bin]),
+ case file:write(NewState#state.cur_fd, [Hi, Lo, Bin]) of
+ ok ->
+ ok;
+ {error, Reason} ->
+ exit({file_exit, Reason})
+ end,
{ok, NewState#state{curB = NewState#state.curB + Size + 2}};
_ ->
{ok, State}
@@ -174,7 +179,7 @@ file_open(Dir, FileNo) ->
write_index_file(Dir, FileNo),
{ok, Fd};
_ ->
- exit({file, open})
+ exit(file_open)
end.
put_int16(I) ->
@@ -211,7 +216,7 @@ write_index_file(Dir, Index) ->
ok = file:close(Fd),
ok = file:rename(TmpFile,File),
ok;
- _ -> exit(open_index_file)
+ _ -> exit(write_index_file)
end.
inc(N, Max) ->
diff --git a/lib/stdlib/src/pool.erl b/lib/stdlib/src/pool.erl
index a5eb191ab2..dfe6318dea 100644
--- a/lib/stdlib/src/pool.erl
+++ b/lib/stdlib/src/pool.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -63,7 +63,7 @@ start(Name) ->
Args :: string(),
Nodes :: [node()].
start(Name, Args) when is_atom(Name) ->
- gen_server:start({global, pool_master}, pool, [], []),
+ _ = gen_server:start({global, pool_master}, pool, [], []),
Hosts = net_adm:host_file(),
Nodes = start_nodes(Hosts, Name, Args),
lists:foreach(fun attach/1, Nodes),
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index c6c706c3a7..0d2fc47d13 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -58,7 +58,7 @@ start(NoCtrlG) ->
start(NoCtrlG, false).
start(NoCtrlG, StartSync) ->
- code:ensure_loaded(user_default),
+ _ = code:ensure_loaded(user_default),
spawn(fun() -> server(NoCtrlG, StartSync) end).
%% Find the pid of the current evaluator process.
@@ -677,8 +677,10 @@ exprs([E0|Es], Bs1, RT, Lf, Ef, Bs0, W) ->
if
Es =:= [] ->
VS = pp(V0, 1, RT),
- [io:requests([{put_chars, unicode, VS}, nl]) ||
- W =:= cmd],
+ case W of
+ cmd -> io:requests([{put_chars, unicode, VS}, nl]);
+ pmt -> ok
+ end,
%% Don't send the result back if it will be
%% discarded anyway.
V = if
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index 54328cd9ff..26821e0e09 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -260,7 +260,7 @@ init_children(State, StartSpec) ->
{ok, NChildren} ->
{ok, State#state{children = NChildren}};
{error, NChildren, Reason} ->
- terminate_children(NChildren, SupName),
+ _ = terminate_children(NChildren, SupName),
{stop, {shutdown, Reason}}
end;
Error ->
@@ -752,7 +752,10 @@ restart(Child, State) ->
Id = if ?is_simple(State) -> Child#child.pid;
true -> Child#child.name
end,
- timer:apply_after(0,?MODULE,try_again_restart,[self(),Id]),
+ {ok, _TRef} = timer:apply_after(0,
+ ?MODULE,
+ try_again_restart,
+ [self(),Id]),
{ok,NState2};
{try_again, NState2, #child{name=ChName}} ->
timer:apply_after(0,?MODULE,try_again_restart,[self(),ChName]),
@@ -850,7 +853,7 @@ terminate_children(Children, SupName) ->
%% we do want them to be shut down as many functions from this module
%% use this function to just clear everything.
terminate_children([Child = #child{restart_type=temporary} | Children], SupName, Res) ->
- do_terminate(Child, SupName),
+ _ = do_terminate(Child, SupName),
terminate_children(Children, SupName, Res);
terminate_children([Child | Children], SupName, Res) ->
NChild = do_terminate(Child, SupName),
@@ -1008,7 +1011,7 @@ wait_dynamic_children(_Child, _Pids, 0, undefined, EStack) ->
wait_dynamic_children(_Child, _Pids, 0, TRef, EStack) ->
%% If the timer has expired before its cancellation, we must empty the
%% mail-box of the 'timeout'-message.
- erlang:cancel_timer(TRef),
+ _ = erlang:cancel_timer(TRef),
receive
{timeout, TRef, kill} ->
EStack
diff --git a/lib/stdlib/src/sys.erl b/lib/stdlib/src/sys.erl
index bffeb44179..5359a6d5bc 100644
--- a/lib/stdlib/src/sys.erl
+++ b/lib/stdlib/src/sys.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -320,7 +320,7 @@ handle_system_msg(SysState, Msg, From, Parent, Mod, Debug, Misc, Hib) ->
gen:reply(From, Reply),
suspend_loop(suspended, Parent, Mod, NDebug, NMisc, Hib);
{running, Reply, NDebug, NMisc} ->
- gen:reply(From, Reply),
+ _ = gen:reply(From, Reply),
Mod:system_continue(Parent, NDebug, NMisc)
end.
diff --git a/lib/stdlib/src/timer.erl b/lib/stdlib/src/timer.erl
index e11fb046e9..72a2dd9616 100644
--- a/lib/stdlib/src/timer.erl
+++ b/lib/stdlib/src/timer.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -258,7 +258,7 @@ ensure_started() ->
undefined ->
C = {timer_server, {?MODULE, start_link, []}, permanent, 1000,
worker, [?MODULE]},
- supervisor:start_child(kernel_safe_sup, C), % kernel_safe_sup
+ _ = supervisor:start_child(kernel_safe_sup, C),
ok;
_ -> ok
end.