couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject git commit: Log error on failure writing to the URI file
Date Tue, 01 Nov 2011 20:01:51 GMT
Updated Branches:
  refs/heads/master 4a0d87dfa -> 2bdc0b4f0


Log error on failure writing to the URI file

Report, and most of the work by RogutÄ—s Sparnuotos.
Thanks. Closes COUCHDB-1326.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/2bdc0b4f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/2bdc0b4f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/2bdc0b4f

Branch: refs/heads/master
Commit: 2bdc0b4f0467eb1243be635efc5bece524979d56
Parents: 4a0d87d
Author: Filipe David Manana <fdmanana@apache.org>
Authored: Tue Nov 1 19:59:02 2011 +0000
Committer: Filipe David Manana <fdmanana@apache.org>
Committed: Tue Nov 1 19:59:02 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_server_sup.erl |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/2bdc0b4f/src/couchdb/couch_server_sup.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_server_sup.erl b/src/couchdb/couch_server_sup.erl
index ac084f4..7baede3 100644
--- a/src/couchdb/couch_server_sup.erl
+++ b/src/couchdb/couch_server_sup.erl
@@ -119,7 +119,15 @@ start_server(IniFiles) ->
             undefined -> [];
             Uri -> io_lib:format("~s~n", [Uri])
             end end || Uri <- Uris],
-        ok = file:write_file(UriFile, Lines)
+        case file:write_file(UriFile, Lines) of
+        ok -> ok;
+        {error, eacces} ->
+            ?LOG_ERROR("Permission error when writing to URI file ~s", [UriFile]),
+            throw({file_permission_error, UriFile});
+        Error2 ->
+            ?LOG_ERROR("Failed to write to URI file ~s: ~p~n", [UriFile, Error2]),
+            throw(Error2)
+        end
     end,
 
     {ok, Pid}.


Mime
View raw message