summaryrefslogtreecommitdiff
path: root/src/util.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.erl')
-rw-r--r--src/util.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/util.erl b/src/util.erl
index 2125d5e..c3b30db 100644
--- a/src/util.erl
+++ b/src/util.erl
@@ -2,7 +2,7 @@
%%% See LICENSE for licensing information.
-module(util).
--export([tempfilename/1, fsync/1, exit_with_error/3,
+-export([tempfilename/1, fsync/1, fsync/2, exit_with_error/3,
check_error/3, write_tempfile_and_rename/3,
spawn_and_wait/1]).
@@ -14,14 +14,17 @@ tempfilename(Base) ->
Filename.
-spec fsync([string()]) -> ok.
-fsync(Paths) ->
- case fsyncport:fsyncall(Paths) of
+fsync(Paths, Timeout) ->
+ case fsyncport:fsyncall(Paths, Timeout) of
ok ->
ok;
{error, Error} ->
exit_with_error(fsync, Error, "Error in fsync")
end.
+fsync(Paths) ->
+ fsync(Paths, 5000).
+
-spec exit_with_error(atom(), atom(), string()) -> no_return().
exit_with_error(Operation, Error, ErrorMessage) ->
io:format("~s(~w): ~w~n", [ErrorMessage, Operation, Error]),