diff options
author | Tom Cherry <tomcherry@google.com> | 2015-05-12 13:54:41 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-05-12 19:42:38 -0700 |
commit | cce7e93b287835ffe9cdc3dad3fac52972d84560 (patch) | |
tree | 85f66bc9b1e39bdf7988e1a841bd6716cab20030 /init/builtins.cpp | |
parent | 30cc3d72498326c77b75cdf02992211d31396b33 (diff) | |
download | system_core-cce7e93b287835ffe9cdc3dad3fac52972d84560.zip system_core-cce7e93b287835ffe9cdc3dad3fac52972d84560.tar.gz system_core-cce7e93b287835ffe9cdc3dad3fac52972d84560.tar.bz2 |
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().
Bug: http://b/21079470
Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
(cherry picked from commit eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b)
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index f59d1fe..735033e 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -57,16 +57,13 @@ extern "C" int init_module(void *, unsigned long, const char *); static int insmod(const char *filename, char *options) { - std::string module; char filename_val[PROP_VALUE_MAX]; - int ret; - - ret = expand_props(filename_val, filename, sizeof(filename_val)); - if (ret) { + if (expand_props(filename_val, filename, sizeof(filename_val)) == -1) { ERROR("insmod: cannot expand '%s'\n", filename); return -EINVAL; } + std::string module; if (!read_file(filename_val, &module)) { return -1; } |