From 9e4abecfc2d26dc9ec109c24d97ee03c111e1d30 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 25 Jul 2011 21:25:40 +0000 Subject: assert that calls to file functions actually succeed. 1) couch_file:sync could leave open fd's if close failed. Now we'll get a trace. 2) couch_file:append_term failing would be bad, so let's test that too. backported from trunk r1150915 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1150918 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_file.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/couchdb/couch_file.erl') diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 7b677034..07ec18dc 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -164,7 +164,7 @@ truncate(Fd, Pos) -> sync(Filepath) when is_list(Filepath) -> {ok, Fd} = file:open(Filepath, [append, raw]), - try file:sync(Fd) after file:close(Fd) end; + try ok = file:sync(Fd) after ok = file:close(Fd) end; sync(Fd) -> gen_server:call(Fd, sync, infinity). -- cgit v1.2.3