summaryrefslogtreecommitdiffstats
path: root/updater/updater.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-04-30 20:49:59 +0200
committerTianjie Xu <xunchang@google.com>2016-05-20 22:56:53 +0200
commit162558382b768a4120b3e41090a4c7b53f11469a (patch)
tree7e0d268233fc6bea07a361cf6913fc3a5e524063 /updater/updater.cpp
parentAdd time and I/O info to last_install (diff)
downloadandroid_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.gz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.bz2
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.lz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.xz
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.tar.zst
android_bootable_recovery-162558382b768a4120b3e41090a4c7b53f11469a.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 1693fa1db..b5db71e2a 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -156,11 +156,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 {