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 14:18:49 -0700
commitc6cfd943e43fa48903f6b23e1d42d2cf3e3d0cbf (patch)
tree23bfd9a467fa4be2d5eddf7bf706ca72edb84f54 /init/builtins.cpp
parent3f7bf52cb0b4c5ba8fc0c5d2a3ae8aee924cb3f3 (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/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 88d6165094..9e5f9ff89f 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;
}