diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2011-01-07 11:43:46 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2011-01-07 11:43:46 +0000 |
commit | c73a8da174f846e5fa401a25c47cb452f9a8bca6 (patch) | |
tree | 75b9293bcfd5c12735597095182c88b82bb98366 /src/couchdb/couch_config.erl | |
parent | b82a37b821b6b943470fcc4476b5530cb48ef4ab (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.erl')
-rw-r--r-- | src/couchdb/couch_config.erl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/couchdb/couch_config.erl b/src/couchdb/couch_config.erl index be53e3a3..34bb97fa 100644 --- a/src/couchdb/couch_config.erl +++ b/src/couchdb/couch_config.erl @@ -112,8 +112,7 @@ handle_call(all, _From, Config) -> Resp = lists:sort((ets:tab2list(?MODULE))), {reply, Resp, Config}; handle_call({set, Sec, Key, Val, Persist}, From, Config) -> - true = ets:insert(?MODULE, {{Sec, Key}, Val}), - case {Persist, Config#config.write_filename} of + Result = case {Persist, Config#config.write_filename} of {true, undefined} -> ok; {true, FileName} -> @@ -121,11 +120,17 @@ handle_call({set, Sec, Key, Val, Persist}, From, Config) -> _ -> ok end, - spawn_link(fun() -> - [catch F(Sec, Key, Val, Persist) || {_Pid, F} <- Config#config.notify_funs], - gen_server:reply(From, ok) - end), - {noreply, Config}; + case Result of + ok -> + true = ets:insert(?MODULE, {{Sec, Key}, Val}), + spawn_link(fun() -> + [catch F(Sec, Key, Val, Persist) || {_Pid, F} <- Config#config.notify_funs], + gen_server:reply(From, ok) + end), + {noreply, Config}; + _Error -> + {reply, Result, Config} + end; handle_call({delete, Sec, Key, Persist}, From, Config) -> true = ets:delete(?MODULE, {Sec,Key}), case {Persist, Config#config.write_filename} of |