aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/dets_utils.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-04-22 15:28:49 +0200
committerHans Bolinder <[email protected]>2013-05-06 12:14:12 +0200
commit21a7806986d58480367cff8d385a12f9659c7754 (patch)
treecba88bf517ff4f86b86bb0d649f5204bac4d9ade /lib/stdlib/src/dets_utils.erl
parent0dc5a00011d1d24b68c9d43ff608415f84c50499 (diff)
downloadotp-21a7806986d58480367cff8d385a12f9659c7754.tar.gz
otp-21a7806986d58480367cff8d385a12f9659c7754.tar.bz2
otp-21a7806986d58480367cff8d385a12f9659c7754.zip
Fix unmatched_returns warnings in STDLIB and Kernel
Diffstat (limited to 'lib/stdlib/src/dets_utils.erl')
-rw-r--r--lib/stdlib/src/dets_utils.erl24
1 files changed, 12 insertions, 12 deletions
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,