diff options
Diffstat (limited to 'lib/stdlib/src/ets.erl')
-rw-r--r-- | lib/stdlib/src/ets.erl | 33 |
1 files changed, 20 insertions, 13 deletions
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), |