From 40b01777dd64941daffbe22fc25cb3a25eee0998 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 15 Apr 2015 17:19:49 +0200 Subject: Be less strict when writing entryhash files. Closes CATLFISH-44. --- src/db.erl | 5 ++--- src/frontend.erl | 2 +- src/storage.erl | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/db.erl b/src/db.erl index 19f73a6..b0c6eaa 100644 --- a/src/db.erl +++ b/src/db.erl @@ -57,10 +57,9 @@ add(LeafHash, Data) -> lager:debug("leafhash ~s added", [mochihex:to_hex(LeafHash)]), ok. --spec add_entryhash(binary(), binary()) -> ok. +-spec add_entryhash(binary(), binary()) -> ok | differ. add_entryhash(LeafHash, EntryHash) -> - ok = perm:ensurefile_nosync(entryhash_root_path(), EntryHash, LeafHash), - ok. + perm:ensurefile_nosync(entryhash_root_path(), EntryHash, LeafHash). -spec add_index_nosync(binary(), non_neg_integer()) -> ok. add_index_nosync(LeafHash, Index) -> diff --git a/src/frontend.erl b/src/frontend.erl index 208b4c7..2689956 100644 --- a/src/frontend.erl +++ b/src/frontend.erl @@ -128,7 +128,7 @@ check_entry(LeafHash, Index) -> {Index, LeafHash, Entry} -> {ok, {Module, Function}} = application:get_env(plop, entryhash_from_entry), EntryHash = Module:Function(Entry), - ok = db:add_entryhash(LeafHash, EntryHash), + db:add_entryhash(LeafHash, EntryHash), ok end. diff --git a/src/storage.erl b/src/storage.erl index 9f4bb5a..e208d9b 100644 --- a/src/storage.erl +++ b/src/storage.erl @@ -26,7 +26,7 @@ request(post, "ct/storage/entrycommitted", Input) -> {struct, PropList} -> EntryHash = base64:decode(proplists:get_value(<<"entryhash">>, PropList)), LeafHash = base64:decode(proplists:get_value(<<"treeleafhash">>, PropList)), - ok = db:add_entryhash(LeafHash, EntryHash), + db:add_entryhash(LeafHash, EntryHash), success({[{result, <<"ok">>}]}) end; request(get, "ct/storage/fetchnewentries", _Input) -> -- cgit v1.1