From 8e5e4dada713609c9b2c45ea9cf4572bb89ef761 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 14 Sep 2010 18:06:55 -0700 Subject: close update package before installing; allow remount Close the update package before invoking the binary, to allow the installer to unmount /cache if it wants to. Add a function to allow remounting of a mount as read-only. Change-Id: Idfcc96c3da66083295177f729263560be58034e4 --- install.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'install.c') diff --git a/install.c b/install.c index 35ba6ca70..40f182d77 100644 --- a/install.c +++ b/install.c @@ -42,6 +42,7 @@ try_update_binary(const char *path, ZipArchive *zip) { const ZipEntry* binary_entry = mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME); if (binary_entry == NULL) { + mzCloseZipArchive(zip); return INSTALL_CORRUPT; } @@ -49,11 +50,13 @@ try_update_binary(const char *path, ZipArchive *zip) { unlink(binary); int fd = creat(binary, 0755); if (fd < 0) { + mzCloseZipArchive(zip); LOGE("Can't make %s\n", binary); return 1; } bool ok = mzExtractZipEntryToFile(zip, binary_entry, fd); close(fd); + mzCloseZipArchive(zip); if (!ok) { LOGE("Can't copy %s\n", ASSUMED_UPDATE_BINARY_NAME); @@ -298,6 +301,5 @@ install_package(const char *root_path) /* Verify and install the contents of the package. */ int status = handle_update_package(path, &zip); - mzCloseZipArchive(&zip); return status; } -- cgit v1.2.3