This is an automated email from the ASF dual-hosted git repository. chhsiao pushed a commit to branch 1.7.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit d3db86a085575189356c2099cc0a0030d724dc35 Author: Benjamin Bannier <benjamin.bann...@mesosphere.io> AuthorDate: Wed Dec 5 13:01:30 2018 -0800 Fixed handling for offer operation updates. The handling of offer operation updates introduced in `c946615ec6d` made use of an update's `latest_status` without making sure that any value was set. This could lead to situation where an uninitialized enum value was switched on which would have caused a fatal error at runtime. This patch replaces uses of `latest_status` with `state` which does contain the information we care about. We also adjust the error logging so we log the value that lead to the error, not some other value. Review: https://reviews.apache.org/r/69157/ --- src/slave/slave.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 7425cfb..218ca83 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -8011,7 +8011,7 @@ void Slave::updateOperation( return; } - switch (update.latest_status().state()) { + switch (operation->latest_status().state()) { // Terminal state, and the conversion is successful. case OPERATION_FINISHED: { apply(operation); @@ -8032,8 +8032,8 @@ void Slave::updateOperation( case OPERATION_GONE_BY_OPERATOR: case OPERATION_RECOVERING: case OPERATION_UNKNOWN: { - LOG(FATAL) << "Unexpected operation state " - << operation->latest_status().state(); + LOG(FATAL) + << "Unexpected operation state " << operation->latest_status().state(); } } }