fs_mgr: Fix kernel command line parsing
Remove new line character ('\n') from the kernel command line after reading from '/proc/cmdline'. This character is not contained in the original string and is added as a result of reading (according to kernel source codes [1]): ... seq_puts(m, saved_command_line); seq_putc(m, '\n'); ... As a result, this may corrupt the last argument of the string. For example, if the last argument is 'androidboot.slot_suffix=_a', then the target partition ('vendor_a\n') will not be found in fstab section of the device tree. [1] fs/proc/cmdline.c Change-Id: I96a853f1f55f27d782afe2ca8c0b006a75368149 Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
This commit is contained in:
parent
1baa19b1a6
commit
23249c9fc5
1 changed files with 3 additions and 0 deletions
|
@ -81,6 +81,9 @@ bool fs_mgr_get_boot_config_from_kernel(const std::string& cmdline, const std::s
|
|||
bool fs_mgr_get_boot_config_from_kernel_cmdline(const std::string& key, std::string* out_val) {
|
||||
std::string cmdline;
|
||||
if (!android::base::ReadFileToString("/proc/cmdline", &cmdline)) return false;
|
||||
if (!cmdline.empty() && cmdline.back() == '\n') {
|
||||
cmdline.pop_back();
|
||||
}
|
||||
return fs_mgr_get_boot_config_from_kernel(cmdline, key, out_val);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue