summaryrefslogtreecommitdiff
path: root/src/common/config.cc
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2013-07-16 18:45:25 -0700
committerDan Mick <dan.mick@inktank.com>2013-07-16 23:00:06 -0700
commitc9297e35b1aad7e650532b420e460392bfb1aa15 (patch)
tree07c70f6fe5bcab9df77c60f2425f61c74cb8f3f6 /src/common/config.cc
parentd45429b81ab9817284d6dca98077cb77b5e8280f (diff)
downloadceph-wip-5634.tar.gz
ceph, config, auth: better messages on failure to open keyring/ceph.confwip-5634
If something as simple as file ownership is wrong, Ceph commands and daemons can fail to run, and the diagnostics are not great. Improve that for at least the specific cases of unopenable keyring and ceph.conf files. Fixes: #5634 Signed-off-by: Dan Mick <dan.mick@inktank.com>
Diffstat (limited to 'src/common/config.cc')
-rw-r--r--src/common/config.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/common/config.cc b/src/common/config.cc
index 5c64f4ec151..79415c74fa1 100644
--- a/src/common/config.cc
+++ b/src/common/config.cc
@@ -96,7 +96,7 @@ struct config_option config_optionsp[] = {
const int NUM_CONFIG_OPTIONS = sizeof(config_optionsp) / sizeof(config_option);
-bool ceph_resolve_file_search(const std::string& filename_list,
+int ceph_resolve_file_search(const std::string& filename_list,
std::string& result)
{
list<string> ls;
@@ -105,15 +105,20 @@ bool ceph_resolve_file_search(const std::string& filename_list,
list<string>::iterator iter;
for (iter = ls.begin(); iter != ls.end(); ++iter) {
int fd = ::open(iter->c_str(), O_RDONLY);
- if (fd < 0)
- continue;
+ if (fd < 0) {
+ if (errno == ENOENT) {
+ continue;
+ } else {
+ return errno;
+ }
+ }
close(fd);
result = *iter;
- return true;
+ return 0;
}
- return false;
+ return ENOENT;
}
md_config_t::md_config_t()