aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2013-04-26 14:21:12 +0200
committerHans Bolinder <[email protected]>2013-05-06 12:14:14 +0200
commit19d41eefa1cf4856587930d99959bbed73a818b5 (patch)
tree51cbb92f4e3e6ae31d678c26e4f49056f144af2e /lib/sasl/src
parentf52452309cf68da898a1768eb6e8b6767e602bc7 (diff)
downloadotp-19d41eefa1cf4856587930d99959bbed73a818b5.tar.gz
otp-19d41eefa1cf4856587930d99959bbed73a818b5.tar.bz2
otp-19d41eefa1cf4856587930d99959bbed73a818b5.zip
Fix unmatched_return warnings in sasl
Diffstat (limited to 'lib/sasl/src')
-rw-r--r--lib/sasl/src/format_lib_supp.erl4
-rw-r--r--lib/sasl/src/rb.erl14
-rw-r--r--lib/sasl/src/release_handler_1.erl2
-rw-r--r--lib/sasl/src/sasl_report_file_h.erl6
-rw-r--r--lib/sasl/src/sasl_report_tty_h.erl4
-rw-r--r--lib/sasl/src/si.erl4
-rw-r--r--lib/sasl/src/si_sasl_supp.erl8
-rw-r--r--lib/sasl/src/systools_lib.erl12
-rw-r--r--lib/sasl/src/systools_make.erl71
-rw-r--r--lib/sasl/src/systools_relup.erl19
10 files changed, 87 insertions, 57 deletions
diff --git a/lib/sasl/src/format_lib_supp.erl b/lib/sasl/src/format_lib_supp.erl
index af15fd3288..5348bc6d59 100644
--- a/lib/sasl/src/format_lib_supp.erl
+++ b/lib/sasl/src/format_lib_supp.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
@@ -77,7 +77,7 @@ print_format(Device, Line, [{data, Data}|T]) ->
print_data(Device, Line, Data),
print_format(Device, Line, T);
print_format(Device, Line, [{table, Table}|T]) ->
- print_table(Device, Line, Table),
+ _ = print_table(Device, Line, Table),
print_format(Device, Line, T);
print_format(Device, Line, [{items, Items}|T]) ->
print_items(Device, Line, Items),
diff --git a/lib/sasl/src/rb.erl b/lib/sasl/src/rb.erl
index 8004ef2c5a..eb65aa8786 100644
--- a/lib/sasl/src/rb.erl
+++ b/lib/sasl/src/rb.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
@@ -309,11 +309,11 @@ scan_files(RptDir, Max, Type) ->
{ok, Fd} ->
case catch file:read(Fd, 1) of
{ok, [LastWritten]} ->
- file:close(Fd),
+ ok = file:close(Fd),
Files = make_file_list(RptDir, LastWritten),
scan_files(RptDir, Files, Max, Type);
_X ->
- file:close(Fd),
+ _ = file:close(Fd),
exit("cannot read the index file")
end;
_X -> exit("cannot read the index file")
@@ -386,7 +386,7 @@ read_reports(No, Fd, Fname, Max, Type) ->
io:format("rb: reading report..."),
case catch read_reports(Fd, [], Type) of
{ok, Res} ->
- file:close(Fd),
+ ok = file:close(Fd),
io:format("done.~n"),
NewRes =
if
@@ -397,7 +397,7 @@ read_reports(No, Fd, Fname, Max, Type) ->
end,
add_report_data(NewRes, No, Fname);
{error, [Problem | Res]} ->
- file:close(Fd),
+ _ = file:close(Fd),
io:format("Error: ~p~n",[Problem]),
io:format("Salvaged ~p entries from corrupt report file ~s...~n",
[length(Res),Fname]),
@@ -898,7 +898,7 @@ handle_bad_form(Date, Msg, Device, Abort, Log) ->
end.
read_rep_msg(Fd, FilePosition) ->
- file:position(Fd, {bof, FilePosition}),
+ {ok,_} = file:position(Fd, {bof, FilePosition}),
Res =
case catch read_report(Fd) of
{ok, Report} ->
@@ -906,5 +906,5 @@ read_rep_msg(Fd, FilePosition) ->
{Date, Report};
_ -> error
end,
- file:close(Fd),
+ ok = file:close(Fd),
Res.
diff --git a/lib/sasl/src/release_handler_1.erl b/lib/sasl/src/release_handler_1.erl
index b37ae2f944..fa6ef77b2d 100644
--- a/lib/sasl/src/release_handler_1.erl
+++ b/lib/sasl/src/release_handler_1.erl
@@ -349,7 +349,7 @@ eval({load, {Mod, _PrePurgeMethod, PostPurgeMethod}}, EvalState) ->
{value, {_Mod, Bin, File}} = lists:keysearch(Mod, 1, Bins),
% load_binary kills all procs running old code
% if soft_purge, we know that there are no such procs now
- code:load_binary(Mod, File, Bin),
+ {module,_} = code:load_binary(Mod, File, Bin),
% Now, the prev current is old. There might be procs
% running it. Find them.
Unpurged = do_soft_purge(Mod,PostPurgeMethod,EvalState#eval_state.unpurged),
diff --git a/lib/sasl/src/sasl_report_file_h.erl b/lib/sasl/src/sasl_report_file_h.erl
index f4810d31cc..f42b4b5ff2 100644
--- a/lib/sasl/src/sasl_report_file_h.erl
+++ b/lib/sasl/src/sasl_report_file_h.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
@@ -40,7 +40,7 @@ init({File, Type}) ->
handle_event({_Type, GL, _Msg}, State) when node(GL) /= node() ->
{ok, State};
handle_event(Event, {Fd, File, Type}) ->
- sasl_report:write_report(Fd, Type, tag_event(Event)),
+ _ = sasl_report:write_report(Fd, Type, tag_event(Event)),
{ok, {Fd, File, Type}};
handle_event(_, State) ->
{ok, State}.
@@ -53,7 +53,7 @@ handle_info(_, State) ->
handle_call(_Query, _State) -> {error, bad_query}.
terminate(_, {Fd, _File, _Type}) ->
- file:close(Fd),
+ _ = file:close(Fd),
[].
tag_event(Event) ->
diff --git a/lib/sasl/src/sasl_report_tty_h.erl b/lib/sasl/src/sasl_report_tty_h.erl
index 064f0471f2..8d63428aeb 100644
--- a/lib/sasl/src/sasl_report_tty_h.erl
+++ b/lib/sasl/src/sasl_report_tty_h.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
@@ -35,7 +35,7 @@ init(Type) ->
handle_event({Type, GL, _Msg}, Type) when node(GL) /= node() ->
{ok, Type};
handle_event(Event, Type) ->
- sasl_report:write_report(standard_io, Type, tag_event(Event)),
+ _ = sasl_report:write_report(standard_io, Type, tag_event(Event)),
{ok, Type}.
handle_info(_, Type) -> {ok, Type}.
diff --git a/lib/sasl/src/si.erl b/lib/sasl/src/si.erl
index eeed7a9f55..e2f6d95e58 100644
--- a/lib/sasl/src/si.erl
+++ b/lib/sasl/src/si.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
@@ -135,7 +135,7 @@ pi_impl(Opt, XPid) ->
{status_info, Pid, {module, Module}, Data} ->
si_sasl_supp:do_best_printout(Opt, Pid, Module, Data);
{error, Reason} ->
- si_sasl_supp:ppi_impl(Pid),
+ _ = si_sasl_supp:ppi_impl(Pid),
{error, {"can not get status info from process:",
XPid,
Reason}};
diff --git a/lib/sasl/src/si_sasl_supp.erl b/lib/sasl/src/si_sasl_supp.erl
index c4fc0c5f08..12b2557cd6 100644
--- a/lib/sasl/src/si_sasl_supp.erl
+++ b/lib/sasl/src/si_sasl_supp.erl
@@ -162,7 +162,7 @@ handle_call(stop, _From, State) ->
{stop, normal, stopped, State}.
terminate(_Reason, _State) ->
- close_device(get(device)),
+ _ = close_device(get(device)),
ok.
handle_cast(_Msg, State) ->
@@ -190,7 +190,7 @@ open_log_file(undefined, NewFile) ->
open_log_file(standard_io, NewFile) ->
open_log_file(NewFile);
open_log_file(OldFile, NewFile) ->
- file:close(OldFile),
+ _ = file:close(OldFile),
open_log_file(NewFile).
open_log_file(standard_io) -> standard_io;
@@ -317,7 +317,7 @@ pi_impl(Opt, XPid) ->
{status_info, Pid, {module, Module}, Data} ->
do_best_printout(Opt, Pid, Module, Data);
{error, Reason} ->
- ppi_impl(Pid),
+ _ = ppi_impl(Pid),
{error, {"can not get status info from process:",
XPid,
Reason}}
@@ -335,7 +335,7 @@ do_best_printout(Opt, Pid, Mod, Data) when is_pid(Pid) ->
case print_info(get(device), Pid, {Mod, format_status}, Opt, Data) of
ok -> ok;
{error, Reason} ->
- ppi_impl(Pid),
+ _ = ppi_impl(Pid),
{error, Reason}
end.
diff --git a/lib/sasl/src/systools_lib.erl b/lib/sasl/src/systools_lib.erl
index 6618baa2aa..0a96f2bd48 100644
--- a/lib/sasl/src/systools_lib.erl
+++ b/lib/sasl/src/systools_lib.erl
@@ -34,8 +34,10 @@
file_term2binary(FileIn, FileOut) ->
case read_term(FileIn) of
{ok, Term} ->
- file:write_file(FileOut, term_to_binary(Term)),
- ok;
+ case file:write_file(FileOut, term_to_binary(Term)) of
+ ok -> ok;
+ {error,Error} -> {error,{open,FileOut,Error}}
+ end;
Other ->
Other
end.
@@ -51,8 +53,10 @@ read_term(File) ->
case file:open(File, [read]) of
{ok, Stream} ->
Res = read_term_from_stream(Stream, File),
- file:close(Stream),
- Res;
+ case file:close(Stream) of
+ ok -> Res;
+ {error,Error} -> {error,{close,File,Error}}
+ end;
{error, Error} ->
{error, {open,File,Error}}
end.
diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl
index 193dbb64bf..0a7d05c753 100644
--- a/lib/sasl/src/systools_make.erl
+++ b/lib/sasl/src/systools_make.erl
@@ -406,9 +406,9 @@ check_rel(Release) ->
end.
check_rel1({release,{Name,Vsn},{erts,EVsn},Appl}) when is_list(Appl) ->
- check_name(Name),
- check_vsn(Vsn),
- check_evsn(EVsn),
+ Name = check_name(Name),
+ Vsn = check_vsn(Vsn),
+ EVsn = check_evsn(EVsn),
{{Appls,Incls},Ws} = check_appl(Appl),
{ok, {Name,Vsn,EVsn,Appls,Incls},Ws};
check_rel1(_) ->
@@ -974,7 +974,8 @@ check_xref(Appls, Path, XrefP) ->
ok;
{error, {already_started, _Pid}} ->
xref:stop(?XREF_SERVER), %% Clear out any previous data
- xref:start(?XREF_SERVER, XrefArgs)
+ {ok,_} = xref:start(?XREF_SERVER, XrefArgs),
+ ok
end,
{ok, _} = xref:set_default(?XREF_SERVER, verbose, false),
LibPath = case Path == code:get_path() of
@@ -1146,14 +1147,17 @@ generate_script(Output, Release, Appls, Flags) ->
{ok, Fd} ->
io:format(Fd, "%% script generated at ~w ~w\n~p.\n",
[date(), time(), Script]),
- file:close(Fd),
-
- BootFile = Output ++ ".boot",
- case file:write_file(BootFile, term_to_binary(Script)) of
+ case file:close(Fd) of
ok ->
- ok;
+ BootFile = Output ++ ".boot",
+ case file:write_file(BootFile, term_to_binary(Script)) of
+ ok ->
+ ok;
+ {error, Reason} ->
+ {error, ?MODULE, {open,BootFile,Reason}}
+ end;
{error, Reason} ->
- {error, ?MODULE, {open,BootFile,Reason}}
+ {error, ?MODULE, {close,ScriptFile,Reason}}
end;
{error, Reason} ->
{error, ?MODULE, {open,ScriptFile,Reason}}
@@ -1529,14 +1533,16 @@ mk_tar(RelName, Release, Appls, Flags, Path1) ->
Tar = open_main_tar(TarName),
case catch mk_tar(Tar, RelName, Release, Appls, Flags, Path1) of
{error,Error} ->
- del_tar(Tar, TarName),
+ _ = del_tar(Tar, TarName),
{error,?MODULE,Error};
{'EXIT',Reason} ->
- del_tar(Tar, TarName),
+ _ = del_tar(Tar, TarName),
{error,?MODULE,Reason};
_ ->
- close_tar(Tar),
- ok
+ case erl_tar:close(Tar) of
+ ok -> ok;
+ {error,Reason} -> {error,?MODULE,{close,TarName,Reason}}
+ end
end.
open_main_tar(TarName) ->
@@ -1591,14 +1597,13 @@ add_variable_tar({Variable,P}, Appls, Tar, Flags) ->
case catch add_applications(Appls, VarTar, [{Variable,P}],
Flags, Variable) of
ok when Flag == include ->
- close_tar(VarTar),
+ close_tar(VarTar,TarName),
add_to_tar(Tar, TarName, TarName),
del_file(TarName);
ok when Flag == ownfile ->
- close_tar(VarTar),
- ok;
+ close_tar(VarTar,TarName);
Error ->
- del_tar(VarTar, TarName),
+ _ = del_tar(VarTar, TarName),
throw(Error)
end
end.
@@ -1856,12 +1861,15 @@ open_tar(TarName) ->
throw({error,{tar_error, {open, TarName, Error}}})
end.
-close_tar(Tar) ->
- erl_tar:close(Tar).
+close_tar(Tar,File) ->
+ case erl_tar:close(Tar) of
+ ok -> ok;
+ {error,Reason} -> throw({error,{close,File,Reason}})
+ end.
del_tar(Tar, TarName) ->
- close_tar(Tar),
- del_file(TarName).
+ _ = erl_tar:close(Tar),
+ file:delete(TarName).
add_to_tar(Tar, FromFile, ToFile) ->
case erl_tar:add(Tar, FromFile, ToFile, [compressed, dereference]) of
@@ -1916,13 +1924,20 @@ read_file(File, Path) ->
Other ->
Other
end,
- file:close(Stream),
- Return;
+ case file:close(Stream) of
+ ok -> Return;
+ {error, Error} -> {error, {close,File,Error}}
+ end;
_Other ->
{error, {not_found, File}}
end.
-del_file(File) -> file:delete(File).
+del_file(File) ->
+ case file:delete(File) of
+ ok -> ok;
+ {error, Error} ->
+ throw({error, {delete, File, Error}})
+ end.
dirp(Dir) ->
case file:read_file_info(Dir) of
@@ -2238,6 +2253,12 @@ format_error({read,File}) ->
format_error({open,File,Error}) ->
io_lib:format("Cannot open ~p - ~ts~n",
[File,file:format_error(Error)]);
+format_error({close,File,Error}) ->
+ io_lib:format("Cannot close ~p - ~ts~n",
+ [File,file:format_error(Error)]);
+format_error({delete,File,Error}) ->
+ io_lib:format("Cannot delete ~p - ~ts~n",
+ [File,file:format_error(Error)]);
format_error({tar_error,What}) ->
form_tar_err(What);
format_error(ListOfErrors) when is_list(ListOfErrors) ->
diff --git a/lib/sasl/src/systools_relup.erl b/lib/sasl/src/systools_relup.erl
index 716dc2b5ff..b3494542e5 100644
--- a/lib/sasl/src/systools_relup.erl
+++ b/lib/sasl/src/systools_relup.erl
@@ -523,7 +523,7 @@ to_list(X) when is_atom(X) -> atom_to_list(X);
to_list(X) when is_list(X) -> X.
-%% write_relup_file(Relup, Opts) -> {ok. Relup}
+%% write_relup_file(Relup, Opts) -> ok
%%
%% Writes a relup file.
%%
@@ -545,12 +545,17 @@ write_relup_file(Relup, Opts) ->
case file:open(Filename, [write]) of
{ok, Fd} ->
io:format(Fd, "~p.~n", [Relup]),
- file:close(Fd);
+ case file:close(Fd) of
+ ok -> ok;
+ {error,Reason} ->
+ throw({error, ?MODULE,
+ {file_problem, {"relup", {close,Reason}}}})
+ end;
{error, Reason} ->
- throw({error, ?MODULE, {file_problem, {"relup", Reason}}})
+ throw({error, ?MODULE,
+ {file_problem, {"relup", {open, Reason}}}})
end
- end,
- {ok, Relup}.
+ end.
add_code_path(Opts) ->
case get_opt(path, Opts) of
@@ -597,8 +602,6 @@ print_error({error, Mod, Error}) ->
print_error(Other) ->
io:format("Error: ~p~n", [Other]).
-format_error({file_problem, {"relup", _Posix}}) ->
- io_lib:format("Could not open file relup~n", []);
format_error({file_problem, {File, What}}) ->
io_lib:format("Could not ~w file ~ts~n", [get_reason(What), File]);
format_error({no_relup, File, App, Vsn}) ->
@@ -642,12 +645,14 @@ format_warning(Prefix, What) ->
get_reason({error, {open, _, _}}) -> open;
get_reason({error, {read, _, _}}) -> read;
get_reason({error, {parse, _, _}}) -> parse;
+get_reason({error, {close, _, _}}) -> close;
get_reason({error, {open, _}}) -> open;
get_reason({error, {read, _}}) -> read;
get_reason({error, {parse, _}}) -> parse;
get_reason({open, _}) -> open;
get_reason({read, _}) -> read;
get_reason({parse, _}) -> parse;
+get_reason({close, _}) -> close;
get_reason(open) -> open;
get_reason(read) -> read;
get_reason(parse) -> parse.