aboutsummaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-11-07 15:13:30 -0800
committerTao Bao <tbao@google.com>2018-11-07 15:25:30 -0800
commite7b775ca2cae76d642715d0d740b8365b84f9b8f (patch)
treec9f701a974b38bd1aaf6b1528cc015bf008da0ec /install.cpp
parent67b7e6403468087460d0aafb403e075d5bbae605 (diff)
downloadandroid_bootable_recovery-e7b775ca2cae76d642715d0d740b8365b84f9b8f.tar.gz
android_bootable_recovery-e7b775ca2cae76d642715d0d740b8365b84f9b8f.tar.bz2
android_bootable_recovery-e7b775ca2cae76d642715d0d740b8365b84f9b8f.zip
Check and dump the signal info for killed updater.
WEXITSTATUS only gives meaningful value if WIFEXITED is true. So we may see a slightly confusing message of "E:Error in /path/to/package (Status 0)" for a killed updater process (e.g. updater calling abort(3)). This CL dumps the signal number for such a case. Test: abort() in child process. Check the output. Change-Id: I72e6654a6499d65155085de658062efb9f1e36ac
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/install.cpp b/install.cpp
index e1e8ee87..680937dd 100644
--- a/install.cpp
+++ b/install.cpp
@@ -497,9 +497,16 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
if (retry_update) {
return INSTALL_RETRY;
}
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
- LOG(ERROR) << "Error in " << package << " (Status " << WEXITSTATUS(status) << ")";
+ if (WIFEXITED(status)) {
+ if (WEXITSTATUS(status) != EXIT_SUCCESS) {
+ LOG(ERROR) << "Error in " << package << " (status " << WEXITSTATUS(status) << ")";
+ return INSTALL_ERROR;
+ }
+ } else if (WIFSIGNALED(status)) {
+ LOG(ERROR) << "Error in " << package << " (killed by signal " << WTERMSIG(status) << ")";
return INSTALL_ERROR;
+ } else {
+ LOG(FATAL) << "Invalid status code " << status;
}
return INSTALL_SUCCESS;