diff options
author | Tom Cherry <tomcherry@google.com> | 2015-05-12 13:54:41 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-05-12 14:18:49 -0700 |
commit | eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b (patch) | |
tree | 23bfd9a467fa4be2d5eddf7bf706ca72edb84f54 /init/ueventd_parser.cpp | |
parent | 7297278ade9de51e63568188782f56e2ad2bcf6b (diff) | |
download | system_core-eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b.tar.gz system_core-eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b.tar.bz2 system_core-eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b.zip |
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/ueventd_parser.cpp')
-rw-r--r-- | init/ueventd_parser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/init/ueventd_parser.cpp b/init/ueventd_parser.cpp index 7a4841f27..497c606dd 100644 --- a/init/ueventd_parser.cpp +++ b/init/ueventd_parser.cpp @@ -193,10 +193,10 @@ static void parse_line(struct parse_state *state, char **args, int nargs) static void parse_config(const char *fn, const std::string& data) { - struct parse_state state; char *args[UEVENTD_PARSER_MAXARGS]; - int nargs; - nargs = 0; + + int nargs = 0; + parse_state state; state.filename = fn; state.line = 1; state.ptr = strdup(data.c_str()); // TODO: fix this code! @@ -231,6 +231,7 @@ int ueventd_parse_config_file(const char *fn) return -1; } + data.push_back('\n'); // TODO: fix parse_config. parse_config(fn, data); dump_parser_state(); return 0; |