diff options
author | Tao Bao <tbao@google.com> | 2016-12-09 23:39:18 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-12-09 23:39:18 +0100 |
commit | f4fabe254c576d53c7634b5569eae1853da3fa07 (patch) | |
tree | f3582f786a6fa82993eed0760bc489c740d93497 | |
parent | Merge "recovery: Fix the argument parsing from COMMAND_FILE." (diff) | |
parent | Merge "write_bootloader_message(<options>) should not reset stage field." (diff) | |
download | android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar.gz android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar.bz2 android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar.lz android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar.xz android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.tar.zst android_bootable_recovery-f4fabe254c576d53c7634b5569eae1853da3fa07.zip |
Diffstat (limited to '')
-rw-r--r-- | bootloader_message/bootloader_message.cpp | 8 | ||||
-rw-r--r-- | bootloader_message/include/bootloader_message/bootloader_message.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp index 9a5671843..294b1725d 100644 --- a/bootloader_message/bootloader_message.cpp +++ b/bootloader_message/bootloader_message.cpp @@ -164,7 +164,13 @@ bool clear_bootloader_message(std::string* err) { } bool write_bootloader_message(const std::vector<std::string>& options, std::string* err) { - bootloader_message boot = {}; + bootloader_message boot; + if (!read_bootloader_message(&boot, err)) { + return false; + } + // Zero out the entire fields. + memset(boot.command, 0, sizeof(boot.command)); + memset(boot.recovery, 0, sizeof(boot.recovery)); strlcpy(boot.command, "boot-recovery", sizeof(boot.command)); strlcpy(boot.recovery, "recovery\n", sizeof(boot.recovery)); for (const auto& s : options) { diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h index b3d2182df..437189e32 100644 --- a/bootloader_message/include/bootloader_message/bootloader_message.h +++ b/bootloader_message/include/bootloader_message/bootloader_message.h @@ -193,7 +193,8 @@ bool write_bootloader_message(const bootloader_message& boot, std::string* err); bool write_bootloader_message_to(const bootloader_message& boot, const std::string& misc_blk_device, std::string* err); -// Write bootloader message (boots into recovery with the options) to BCB. +// Write bootloader message (boots into recovery with the options) to BCB. Will +// set command and recovery fields only. bool write_bootloader_message(const std::vector<std::string>& options, std::string* err); // Clear BCB. |