From c73a8da174f846e5fa401a25c47cb452f9a8bca6 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Fri, 7 Jan 2011 11:43:46 +0000 Subject: 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 --- src/couchdb/couch_config_writer.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/couchdb/couch_config_writer.erl') 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) -> -- cgit v1.2.3