summaryrefslogtreecommitdiff
path: root/src/util.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-09-24 16:38:03 +0200
committerMagnus Ahltorp <map@kth.se>2015-09-24 16:38:03 +0200
commit47739f3a75b247db446eb863ab6d83d6ca461634 (patch)
tree36a07c625e37107ca2f35200ccc444cb6e210a0a /src/util.erl
parentcdd2d16b4acd17ab74cd0610857d07a547f052ab (diff)
Change perm interface to be add/commit based
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]),