| Index: delta_performer.cc
|
| diff --git a/delta_performer.cc b/delta_performer.cc
|
| index 92d4733d02fbc2269f722e47fe206f42958f73a5..5a6c0c1ed7c18759f56493e53bd64a83094371e7 100644
|
| --- a/delta_performer.cc
|
| +++ b/delta_performer.cc
|
| @@ -23,6 +23,7 @@
|
| #include "update_engine/payload_signer.h"
|
| #include "update_engine/prefs_interface.h"
|
| #include "update_engine/subprocess.h"
|
| +#include "update_engine/terminator.h"
|
|
|
| using std::min;
|
| using std::string;
|
| @@ -210,6 +211,8 @@ ssize_t DeltaPerformer::Write(const void* bytes, size_t count) {
|
| next_operation_num_ - manifest_.install_operations_size());
|
| if (!CanPerformInstallOperation(op))
|
| break;
|
| + ScopedTerminatorExitUnblocker exit_unblocker =
|
| + ScopedTerminatorExitUnblocker(); // Avoids a compiler unused var bug.
|
| // Log every thousandth operation, and also the first and last ones
|
| if ((next_operation_num_ % 1000 == 0) ||
|
| (next_operation_num_ + 1 == total_operations)) {
|
| @@ -222,6 +225,7 @@ ssize_t DeltaPerformer::Write(const void* bytes, size_t count) {
|
| // that if the operation gets interrupted, we don't try to resume the
|
| // update.
|
| if (!IsIdempotentOperation(op)) {
|
| + Terminator::set_exit_blocked(true);
|
| ResetUpdateProgress(prefs_);
|
| }
|
| if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
|
| @@ -553,9 +557,10 @@ bool DeltaPerformer::ResetUpdateProgress(PrefsInterface* prefs) {
|
| }
|
|
|
| bool DeltaPerformer::CheckpointUpdateProgress() {
|
| - // First reset the progress in case we die in the middle of the state update.
|
| - ResetUpdateProgress(prefs_);
|
| + Terminator::set_exit_blocked(true);
|
| if (last_updated_buffer_offset_ != buffer_offset_) {
|
| + // Resets the progress in case we die in the middle of the state update.
|
| + ResetUpdateProgress(prefs_);
|
| TEST_AND_RETURN_FALSE(
|
| prefs_->SetString(kPrefsUpdateStateSignedSHA256Context,
|
| hash_calculator_.GetContext()));
|
|
|