From: Alex Schmidt Date: Tue, 4 Jun 2013 12:00:16 +0000 (+0200) Subject: added underscore in cacheid check X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/commitdiff_plain/db68c55d4535522352b71a8d69d3a38ba97c67a5 added underscore in cacheid check --- diff --git a/configcache.cpp b/configcache.cpp index 6cd46a1..bcfe92f 100644 --- a/configcache.cpp +++ b/configcache.cpp @@ -18,6 +18,11 @@ configcache::configcache(const string& cacheid, const int& nequi, const int& nsk DATADIR = datadir; CACHEID = cacheid; + if ( cacheid.find("_") != -1 ) { + if(log) *log << "CCACHE: Invalid cacheid \"" << cacheid << "\" given. Cacheids must not contain underscores!" << endl << flush; + exit(1); + } + configMem = (char*)malloc(configMemSize); tmpConfig = (char*)malloc(configMemSize); @@ -80,7 +85,7 @@ bool configcache::isValidInFile(const string& infile, infiledesc *filedesc) inchar = new char [infile.size()+1]; strcpy (inchar, infile.c_str()); - + inParts = strtok( inchar, "_" ); for(int iPart=0; inParts!=NULL; iPart++) { @@ -88,7 +93,10 @@ bool configcache::isValidInFile(const string& infile, infiledesc *filedesc) switch(iPart) { - case 1: if(inParts != CACHEID) return false; break; + case 1: if(inParts != CACHEID) { + return false; + break; + } case 2: if (atoi(inParts) > NEQUI) return false;