summaryrefslogtreecommitdiff
path: root/init/builtins.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 19:42:38 -0700
commit3706fecde6441ce296b978b923036b44c62fe09a (patch)
tree85f66bc9b1e39bdf7988e1a841bd6716cab20030 /init/builtins.cpp
parentcd953787a8194691131757a4f57591b9dbfd1670 (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(). Bug: http://b/21079470 Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7 (cherry picked from commit eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b)
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index f59d1fe4fc..735033e1d8 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;
}