Do not close the zip archive prematurely. It may be accessed later for a firmware update.

Change-Id: I31c298f75bbcdc7998221aa2b3aa334926343139
This commit is contained in:
Koushik Dutta 2011-05-13 13:01:26 -07:00
parent 9ad8ba21b3
commit 49553c7561

View File

@ -127,10 +127,10 @@ try_update_binary(const char *path, ZipArchive *zip) {
}
bool ok = mzExtractZipEntryToFile(zip, binary_entry, fd);
close(fd);
mzCloseZipArchive(zip);
if (!ok) {
LOGE("Can't copy %s\n", ASSUMED_UPDATE_BINARY_NAME);
mzCloseZipArchive(zip);
return 1;
}
@ -239,13 +239,13 @@ try_update_binary(const char *path, ZipArchive *zip) {
waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
LOGE("Error in %s\n(Status %d)\n", path, WEXITSTATUS(status));
mzCloseZipArchive(zip);
return INSTALL_ERROR;
}
if (firmware_type != NULL) {
mzCloseZipArchive(zip);
return handle_firmware_update(firmware_type, firmware_filename, zip);
} else {
return INSTALL_SUCCESS;
}
return INSTALL_SUCCESS;
}