summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2013-02-21 21:41:25 -0800
committerDan Mick <dan.mick@inktank.com>2013-02-21 21:45:27 -0800
commit8c05af5dc3c398dda4c196a64f344db7ea69d209 (patch)
treeace57f1a8c763dbe46f05fd6c319331d5285fd9a
parentdd007db3ca27627d6a3017c436b6745084288ee5 (diff)
downloadceph-8c05af5dc3c398dda4c196a64f344db7ea69d209.tar.gz
configuration parsing: give better error for missing =
A ceph.conf line with "key" and no "= value" currently shows "unexpected character while parsing putative key value, at char N line M". There's no reason it can't be clearer. Fixes: #4229 Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/ConfUtils.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc
index 147cdc2fb60..5efde8d4ae0 100644
--- a/src/common/ConfUtils.cc
+++ b/src/common/ConfUtils.cc
@@ -471,8 +471,13 @@ process_line(int line_no, const char *line, std::deque<std::string> *errors)
case ACCEPT_KEY:
if ((((c == '#') || (c == ';')) && (!escaping)) || (c == '\0')) {
ostringstream oss;
- oss << "unexpected character while parsing putative key value, "
- << "at char " << (l - line) << ", line " << line_no;
+ if (c == '\0') {
+ oss << "end of key=val line " << line_no
+ << " reached, no \"=val\" found...missing =?";
+ } else {
+ oss << "unexpected character while parsing putative key value, "
+ << "at char " << (l - line) << ", line " << line_no;
+ }
errors->push_back(oss.str());
return NULL;
}