summaryrefslogtreecommitdiffstats
path: root/updater/updater.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-23 21:17:13 +0200
committerTianjie Xu <xunchang@google.com>2016-05-23 21:30:42 +0200
commit549745cc8778f806e46809e472fbcf3c7f066b83 (patch)
tree5c64036573622ef1291e24e8c0c5c036f3052484 /updater/updater.cpp
parentresolve merge conflicts of 86a28d0 to klp-modular-dev am: a5bc59620f am: 36acff7d7e am: 1f814d7630 am: ca45737e27 am: 8a1d4e97ad am: aa02888e55 am: 300af0779d am: fc1d9a49d1 am: b02b2fe392 am: 75dea9ca3a (diff)
parentMerge "Allow recovery to return error codes" into nyc-dev (diff)
downloadandroid_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.gz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.bz2
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.lz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.xz
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.tar.zst
android_bootable_recovery-549745cc8778f806e46809e472fbcf3c7f066b83.zip
Diffstat (limited to 'updater/updater.cpp')
-rw-r--r--updater/updater.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/updater/updater.cpp b/updater/updater.cpp
index 0497d6a85..f51a6db73 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -159,11 +159,28 @@ int main(int argc, char** argv) {
printf("script aborted: %s\n", state.errmsg);
char* line = strtok(state.errmsg, "\n");
while (line) {
+ // Parse the error code in abort message.
+ // Example: "E30: This package is for bullhead devices."
+ if (*line == 'E') {
+ if (sscanf(line, "E%u: ", &state.error_code) != 1) {
+ printf("Failed to parse error code: [%s]\n", line);
+ }
+ }
fprintf(cmd_pipe, "ui_print %s\n", line);
line = strtok(NULL, "\n");
}
fprintf(cmd_pipe, "ui_print\n");
}
+
+ if (state.error_code != kNoError) {
+ fprintf(cmd_pipe, "log error: %d\n", state.error_code);
+ // Cause code should provide additional information about the abort;
+ // report only when an error exists.
+ if (state.cause_code != kNoCause) {
+ fprintf(cmd_pipe, "log cause: %d\n", state.cause_code);
+ }
+ }
+
free(state.errmsg);
return 7;
} else {