diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | src/config.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5c1b617a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/autom4te.cache +Makefile +config.cache +config.log +config.status diff --git a/src/config.c b/src/config.c index 73660d286..f9144b663 100644 --- a/src/config.c +++ b/src/config.c @@ -1050,8 +1050,17 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char *filename, std::o return false; } if (!wordbuffer.empty() || !itemname.empty()) { - errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl; - return false; + // this will allow for the construct: section { key = value } + // but will not allow for anything else, such as: section { key = value; key = value } + if (!sectiondata.empty()) { + errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl; + return false; + } + // this is the same as the below section for testing if itemname is non-empty after the loop, but done inside it to allow the above construct + if (debug) alog("ln %d EOL: s='%s' '%s' set to '%s'", linenumber, section.c_str(), itemname.c_str(), wordbuffer.c_str()); + sectiondata.push_back(KeyVal(itemname, wordbuffer)); + wordbuffer.clear(); + itemname.clear(); } target.insert(std::pair<std::string, KeyValList>(section, sectiondata)); section.clear(); |