summaryrefslogtreecommitdiff
path: root/apps/couch/src/couch_file.erl
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2011-07-25 21:25:40 +0000
committerAdam Kocoloski <adam@cloudant.com>2011-08-12 21:28:27 -0400
commitc78b19296031168aef4142fbe409a0e7d2edda82 (patch)
treeeb96d4e4dc9eb0d059dcba472b20a24c3767a9d2 /apps/couch/src/couch_file.erl
parenta563a53fe829df17844f32686dc8ac2cc45c8380 (diff)
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
Diffstat (limited to 'apps/couch/src/couch_file.erl')
-rw-r--r--apps/couch/src/couch_file.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/couch/src/couch_file.erl b/apps/couch/src/couch_file.erl
index 0136e877..dfc1f822 100644
--- a/apps/couch/src/couch_file.erl
+++ b/apps/couch/src/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).