summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_config_writer.erl
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-01-07 11:43:46 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-01-07 11:43:46 +0000
commitc73a8da174f846e5fa401a25c47cb452f9a8bca6 (patch)
tree75b9293bcfd5c12735597095182c88b82bb98366 /src/couchdb/couch_config_writer.erl
parentb82a37b821b6b943470fcc4476b5530cb48ef4ab (diff)
Merged revision 1056274 from trunk
More explicit and helpful file access permission errors Closes COUCHDB-966 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1056275 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_config_writer.erl')
-rw-r--r--src/couchdb/couch_config_writer.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/couchdb/couch_config_writer.erl b/src/couchdb/couch_config_writer.erl
index c8691d79..decd269a 100644
--- a/src/couchdb/couch_config_writer.erl
+++ b/src/couchdb/couch_config_writer.erl
@@ -35,7 +35,14 @@ save_to_file({{Section, Key}, Value}, File) ->
NewLines = process_file_lines(Lines, [], SectionLine, Pattern, Key, Value),
NewFileContents = reverse_and_add_newline(strip_empty_lines(NewLines), []),
- ok = file:write_file(File, NewFileContents).
+ case file:write_file(File, NewFileContents) of
+ ok ->
+ ok;
+ {error, eacces} ->
+ {file_permission_error, File};
+ Error ->
+ Error
+ end.
process_file_lines([Section|Rest], SeenLines, Section, Pattern, Key, Value) ->