summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Burchell <viroteck@viroteck.net>2012-06-15 02:44:57 -0700
committerRobin Burchell <viroteck@viroteck.net>2012-06-15 02:44:57 -0700
commitf293861ab70eab76ae0715a5f2c2769de332c779 (patch)
treee76445a8a19e6422cbdb92a2ca1c43b357a766ff
parentf960a97cc6b509c756a20d892609825c67c2fc43 (diff)
parent56a238f49b2c40fe0a6c6325f86ddecd7ec7123b (diff)
Merge pull request #193 from attilamolnar/insp20+newlinefix
[2.0] Cut the ending \n from all lines in included (exec)files
-rw-r--r--src/configparser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 51d67b4f5..a8e36f6e0 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -317,9 +317,13 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int
char linebuf[MAXBUF*10];
while (fgets(linebuf, sizeof(linebuf), file))
{
- int len = strlen(linebuf);
+ size_t len = strlen(linebuf);
if (len)
+ {
+ if (linebuf[len-1] == '\n')
+ len--;
cache.push_back(std::string(linebuf, len));
+ }
}
}