summaryrefslogtreecommitdiffstats
path: root/bootloader_message/bootloader_message.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-12-09 23:33:48 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-12-09 23:33:49 +0100
commitf28afc191da4ef9512ac16aae1734142dd5adfc9 (patch)
treef3582f786a6fa82993eed0760bc489c740d93497 /bootloader_message/bootloader_message.cpp
parentMerge "recovery: Fix the argument parsing from COMMAND_FILE." (diff)
parentwrite_bootloader_message(<options>) should not reset stage field. (diff)
downloadandroid_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar.gz
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar.bz2
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar.lz
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar.xz
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.tar.zst
android_bootable_recovery-f28afc191da4ef9512ac16aae1734142dd5adfc9.zip
Diffstat (limited to 'bootloader_message/bootloader_message.cpp')
-rw-r--r--bootloader_message/bootloader_message.cpp8
1 files changed, 7 insertions, 1 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) {