From 3b46884ac89efd5d983dc9d27269f90e3ddac95a Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 12 Mar 2018 20:50:44 +0530 Subject: [PATCH] config: replace '~' by '$home' in CEPH_CONF_FILE_DEFAULT And expand "$home" to get the actual path to ceph.conf. Fixes: http://tracker.ceph.com/issues/23215 Signed-off-by: Rishabh Dave --- src/common/config.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/config.cc b/src/common/config.cc index b07f0a4737832..46371b82e5390 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -42,7 +42,7 @@ using std::ostringstream; using std::pair; using std::string; -static const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config, /etc/ceph/$cluster.conf, ~/.ceph/$cluster.conf, $cluster.conf" +static const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config, /etc/ceph/$cluster.conf, $home/.ceph/$cluster.conf, $cluster.conf" #if defined(__FreeBSD__) ", /usr/local/etc/ceph/$cluster.conf" #endif @@ -1156,6 +1156,9 @@ Option::value_t md_config_t::_expand_meta( out += stringify(getpid()); } else if (var == "cctid") { out += stringify((unsigned long long)this); + } else if (var == "home") { + const char *home = getenv("HOME"); + out = home ? std::string(home) : std::string(); } else { if (var == "data_dir") { var = data_dir_option; -- 2.39.5