summaryrefslogtreecommitdiff
path: root/init/init_parser.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2015-05-12 13:54:41 -0700
committerElliott Hughes <enh@google.com>2015-05-12 14:18:49 -0700
commiteaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b (patch)
tree23bfd9a467fa4be2d5eddf7bf706ca72edb84f54 /init/init_parser.cpp
parent7297278ade9de51e63568188782f56e2ad2bcf6b (diff)
Fix insmod module size
read_file() used to append a new line character to the end of the buffer it returns, because parse_config() isn't able to cope with input that's not '\n'-terminated. Fix read_file() to be less insane, and push the workarounds into the parse_config() callers. Longer term we should rewrite parse_config(). Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
Diffstat (limited to 'init/init_parser.cpp')
-rw-r--r--init/init_parser.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index e5b3b58d6..df049edeb 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -382,13 +382,13 @@ static void parse_new_section(struct parse_state *state, int kw,
static void parse_config(const char *fn, const std::string& data)
{
- struct parse_state state;
struct listnode import_list;
struct listnode *node;
char *args[INIT_PARSER_MAXARGS];
- int nargs;
- nargs = 0;
+ int nargs = 0;
+
+ parse_state state;
state.filename = fn;
state.line = 0;
state.ptr = strdup(data.c_str()); // TODO: fix this code!
@@ -442,6 +442,7 @@ bool init_parse_config_file(const char* path) {
return false;
}
+ data.push_back('\n'); // TODO: fix parse_config.
parse_config(path, data);
dump_parser_state();