summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2018-03-09 17:47:22 +0100
committerJan Lehnardt <jan@apache.org>2018-03-09 19:09:14 +0100
commitf999071ec6b347b27526047cc16a00811e21fdd9 (patch)
tree8b6f43537d1de13a6f3e5d658bd4244dfd971ede
parent42c89bad801f1a6230dd2867d776e8513372137f (diff)
downloadcouchdb-f999071ec6b347b27526047cc16a00811e21fdd9.tar.gz
style fixes as per @davisp
-rw-r--r--src/couch/src/couch_file.erl30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 260a88c5a..9f668ea69 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -216,9 +216,9 @@ sync(Filepath) when is_list(Filepath) ->
case file:open(Filepath, [append, raw]) of
{ok, Fd} ->
try ok = file:sync(Fd) after ok = file:close(Fd) end;
- Error ->
- throw(Error)
- end;
+ {error, Error} ->
+ erlang:error(Error)
+ end;
sync(Fd) ->
gen_server:call(Fd, sync, infinity).
@@ -393,18 +393,18 @@ init({Filepath, Options, ReturnPid, Ref}) ->
% open in read mode first, so we don't create the file if it doesn't exist.
case file:open(Filepath, [read, raw]) of
{ok, Fd_Read} ->
- case file:open(Filepath, OpenOptions) of
- {ok, Fd} ->
- %% Save Fd in process dictionary for debugging purposes
- put(couch_file_fd, {Fd, Filepath}),
- ok = file:close(Fd_Read),
- maybe_track_open_os_files(Options),
- {ok, Eof} = file:position(Fd, eof),
- erlang:send_after(?INITIAL_WAIT, self(), maybe_close),
- {ok, #file{fd=Fd, eof=Eof, is_sys=IsSys, pread_limit=Limit}};
- Error ->
- init_status_error(ReturnPid, Ref, Error)
- end;
+ case file:open(Filepath, OpenOptions) of
+ {ok, Fd} ->
+ %% Save Fd in process dictionary for debugging purposes
+ put(couch_file_fd, {Fd, Filepath}),
+ ok = file:close(Fd_Read),
+ maybe_track_open_os_files(Options),
+ {ok, Eof} = file:position(Fd, eof),
+ erlang:send_after(?INITIAL_WAIT, self(), maybe_close),
+ {ok, #file{fd=Fd, eof=Eof, is_sys=IsSys, pread_limit=Limit}};
+ Error ->
+ init_status_error(ReturnPid, Ref, Error)
+ end;
Error ->
init_status_error(ReturnPid, Ref, Error)
end