diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-09-16 20:28:39 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-09-16 20:28:39 +0200 |
commit | 4f97fcbbde7749fd5379fb006542fec0dea6bfeb (patch) | |
tree | 84b3a24bf984d4e90e3385bb24f08a8198ee98b4 /glcddrivers/config.c | |
parent | 7178bcc48bc3377c4027e362ba217e9f3815cea5 (diff) | |
download | graphlcd-base-4f97fcbbde7749fd5379fb006542fec0dea6bfeb.tar.gz graphlcd-base-4f97fcbbde7749fd5379fb006542fec0dea6bfeb.tar.bz2 |
added methods to cDriver: ConfigName() and DriverName(); graphlcd.conf: forbid ':' in section names, added check to config.c to enforce this
Diffstat (limited to 'glcddrivers/config.c')
-rw-r--r-- | glcddrivers/config.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/glcddrivers/config.c b/glcddrivers/config.c index ef88279..15338b6 100644 --- a/glcddrivers/config.c +++ b/glcddrivers/config.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users sourceforge net> */ #include <syslog.h> @@ -214,6 +215,12 @@ bool cConfig::Load(const std::string & filename) continue; if (line[0] == '[' && line[line.length() - 1] == ']') { + // no ':' in section names + if (line.substr(1, line.length() - 2).find(':') != std::string::npos) { + syslog(LOG_ERR, "Config error: section name may not contain a ':', erraneous line: '%s'\n", line.c_str()); + file.close(); + return false; + } if (!inSections) inSections = true; else |