summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Moore <devinmoore@google.com>2021-07-07 16:34:06 -0700
committerDevin Moore <devinmoore@google.com>2021-07-08 16:53:59 +0000
commit91ef4dacce84ef72412cc033624dc66675cf52a0 (patch)
tree24e66007ff7241fc7f700e4da994e786e6e5ed1f
parentb7f123fb66af739b7f93f1b35e4249a009c04c92 (diff)
downloadcore-91ef4dacce84ef72412cc033624dc66675cf52a0.tar.gz
init: remove extra space in list of bootconfig values
If a bootconfig argument has a list of values, it has a space between them in /proc/bootconfig. Example: BOARD_BOOTCONFIG := parameter=value1,value2,value3 In /proc/bootconfig, it looks like: parameter = "value1", "value2", "value3" Before this CL, that example would end up with the value string of: "value1, value2, value3" To keep consistent behavior with kernel cmdline the value string should be: "value1,value2,value3" Test: Boot cuttlefish with test bootconfig params and verify ro.boot.* Bug: 192257482 Merged-In: Iccdec451f53330162fa2c9ad2b7c2630f32b4168 Change-Id: Iccdec451f53330162fa2c9ad2b7c2630f32b4168
-rw-r--r--init/util.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/init/util.cpp b/init/util.cpp
index a40d10416..9f7bfdb5b 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -253,8 +253,10 @@ void ImportBootconfig(const std::function<void(const std::string&, const std::st
for (const auto& entry : android::base::Split(bootconfig, "\n")) {
std::vector<std::string> pieces = android::base::Split(entry, "=");
if (pieces.size() == 2) {
- pieces[1].erase(std::remove(pieces[1].begin(), pieces[1].end(), '"'), pieces[1].end());
- fn(android::base::Trim(pieces[0]), android::base::Trim(pieces[1]));
+ // get rid of the extra space between a list of values and remove the quotes.
+ std::string value = android::base::StringReplace(pieces[1], "\", \"", ",", true);
+ value.erase(std::remove(value.begin(), value.end(), '"'), value.end());
+ fn(android::base::Trim(pieces[0]), android::base::Trim(value));
}
}
}