Add a default error code when updater script aborts
We didn't report error/cause codes unless there's an explict "Abort()" call inside the updater script. As a result, some cause codes set by ErrorAbort() didn't show up in last_install. To fix the issue, add a default error code when the script terminates abnormally (i.e. with non zero status). Bug: 37912405 Test: error/cause code shows up in last_install when argument parsing fails Change-Id: Ic6d3bd1855b853aeaa0760071e593a00cf6f0209
This commit is contained in:
parent
c99bb23955
commit
e0c88793d1
2 changed files with 10 additions and 7 deletions
|
@ -24,6 +24,7 @@ enum ErrorCode {
|
|||
kZipOpenFailure,
|
||||
kBootreasonInBlacklist,
|
||||
kPackageCompatibilityFailure,
|
||||
kScriptExecutionFailure,
|
||||
};
|
||||
|
||||
enum CauseCode {
|
||||
|
|
|
@ -193,14 +193,16 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.error_code != kNoError) {
|
||||
// Installation has been aborted. Set the error code to kScriptExecutionFailure unless
|
||||
// a more specific code has been set in errmsg.
|
||||
if (state.error_code == kNoError) {
|
||||
state.error_code = kScriptExecutionFailure;
|
||||
}
|
||||
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.
|
||||
// Cause code should provide additional information about the abort.
|
||||
if (state.cause_code != kNoCause) {
|
||||
fprintf(cmd_pipe, "log cause: %d\n", state.cause_code);
|
||||
}
|
||||
}
|
||||
|
||||
if (updater_info.package_zip) {
|
||||
CloseArchive(updater_info.package_zip);
|
||||
|
|
Loading…
Reference in a new issue