diff options
| author | Colin Cross <ccross@android.com> | 2013-06-18 01:11:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-06-18 01:11:59 +0000 |
| commit | 95a41f6b20c678c5f475558ac00ab449ffd1f481 (patch) | |
| tree | 69b7713262ba10a7e7076813ecdf55b2539b5f89 /init/init.c | |
| parent | 865bb05dd0db1531f252de5e137605beec171ca2 (diff) | |
| parent | 5e484e9c439f8c065270209f32bdbfb731729250 (diff) | |
| download | system_core-95a41f6b20c678c5f475558ac00ab449ffd1f481.zip system_core-95a41f6b20c678c5f475558ac00ab449ffd1f481.tar.gz system_core-95a41f6b20c678c5f475558ac00ab449ffd1f481.tar.bz2 | |
Merge changes Ia7b337e1,I7a2d8aa5,Iacc2b42b,Idf6100d1,If3fba2cc
* changes:
init: fix copying boot properties
toolbox: hide property implementation from watchprops
init: verify size of property buffers passed to property_get
init: move the system property writer implementation
init: switch property_get to use __system_property_get
Diffstat (limited to 'init/init.c')
| -rwxr-xr-x | init/init.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/init/init.c b/init/init.c index 39df0ff..afa4d44 100755 --- a/init/init.c +++ b/init/init.c @@ -625,7 +625,7 @@ static void import_kernel_nv(char *name, int for_emulator) static void export_kernel_boot_props(void) { char tmp[PROP_VALUE_MAX]; - const char *pval; + int ret; unsigned i; struct { const char *src_prop; @@ -639,22 +639,26 @@ static void export_kernel_boot_props(void) }; for (i = 0; i < ARRAY_SIZE(prop_map); i++) { - pval = property_get(prop_map[i].src_prop); - property_set(prop_map[i].dest_prop, pval ?: prop_map[i].def_val); + ret = property_get(prop_map[i].src_prop, tmp); + if (ret > 0) + property_set(prop_map[i].dest_prop, tmp); + else + property_set(prop_map[i].dest_prop, prop_map[i].def_val); } - pval = property_get("ro.boot.console"); - if (pval) - strlcpy(console, pval, sizeof(console)); + ret = property_get("ro.boot.console", tmp); + if (ret) + strlcpy(console, tmp, sizeof(console)); /* save a copy for init's usage during boot */ - strlcpy(bootmode, property_get("ro.bootmode"), sizeof(bootmode)); + property_get("ro.bootmode", tmp); + strlcpy(bootmode, tmp, sizeof(bootmode)); /* if this was given on kernel command line, override what we read * before (e.g. from /proc/cpuinfo), if anything */ - pval = property_get("ro.boot.hardware"); - if (pval) - strlcpy(hardware, pval, sizeof(hardware)); + ret = property_get("ro.boot.hardware", tmp); + if (ret) + strlcpy(hardware, tmp, sizeof(hardware)); property_set("ro.hardware", hardware); snprintf(tmp, PROP_VALUE_MAX, "%d", revision); |
