summaryrefslogtreecommitdiff
path: root/src/util.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-09-24 16:38:03 +0200
committerLinus Nordberg <linus@nordu.net>2015-11-11 13:32:36 +0100
commit90760d10d14c11ee4c99826163c206bbf20a77f6 (patch)
tree5965c6bb108538507464d98595cc631dd9441aa7 /src/util.erl
parent346a3f973b828abc21cffb8a0a976daddcabe492 (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]),