From 1c2bc9120aa15c6c8974f2260dcd825a7775453d Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan.bastani@ens.fr> Date: Thu, 7 Jun 2012 13:32:57 +0200 Subject: [PATCH] config file: only allow GlobalInitFile option to hooks block, one more error check --- preprocessor/ConfigFile.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/preprocessor/ConfigFile.cc b/preprocessor/ConfigFile.cc index 21276dd91b..2d0e349995 100644 --- a/preprocessor/ConfigFile.cc +++ b/preprocessor/ConfigFile.cc @@ -220,10 +220,19 @@ ConfigFile::getConfigFileInfo(const string &config_file) trim(tokenizedLine.back()); if (inHooks) - { - if (!tokenizedLine.front().compare("GlobalInitFile")) + if (!tokenizedLine.front().compare("GlobalInitFile")) + if (global_init_file.empty()) global_init_file = tokenizedLine.back(); - } + else + { + cerr << "ERROR: May not have more than one GlobalInitFile option in [hooks] block." << endl; + exit(EXIT_FAILURE); + } + else + { + cerr << "ERROR: Unrecognized option " << tokenizedLine.front() << " in [hooks] block." << endl; + exit(EXIT_FAILURE); + } else if (!tokenizedLine.front().compare("Name")) name = tokenizedLine.back(); -- GitLab