Silence a crash in update_engine when dns resolution fails
Summary: This change silence below crash. It occurs in certain
conditions when a connection fails while it is paused
Error:
SIGABRT:/system/bin/update_engine::chromeos_update_engine::(anonymous
namespace)::RedirectToLiblog(int, char const*, int, unsigned long, std::
Test: build passes
Change-Id: I7b38c354d2a5d484b993944a14c8c2da56cf9650
Signed-off-by: Abhishek Gadewar <abhishekgadewar@meta.com>
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 08c8a67..db94a6f 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -648,11 +648,17 @@
return;
}
CHECK(curl_handle_);
- CHECK_EQ(curl_easy_pause(curl_handle_, CURLPAUSE_CONT), CURLE_OK);
- // Since the transfer is in progress, we need to dispatch a CurlPerformOnce()
- // now to let the connection continue, otherwise it would be called by the
- // TimeoutCallback but with a delay.
- CurlPerformOnce();
+ auto ret = curl_easy_pause(curl_handle_, CURLPAUSE_CONT);
+ if (ret != CURLE_OK) {
+ LOG(ERROR) << "Failed to unpause connection, reason: " << ret
+ << ". Terminating transfer.";
+ TerminateTransfer();
+ } else {
+ // Since the transfer is in progress, we need to dispatch a
+ // CurlPerformOnce() now to let the connection continue, otherwise it would
+ // be called by the TimeoutCallback but with a delay.
+ CurlPerformOnce();
+ }
}
// This method sets up callbacks with the MessageLoop.