summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-09-15 03:06:55 +0200
committerDoug Zongker <dougz@android.com>2010-09-15 06:26:38 +0200
commit8e5e4dada713609c9b2c45ea9cf4572bb89ef761 (patch)
treeb1dd9d0f6408811e71dade4f1ccbc52f18114a5e
parentadd the ability to seek to a raw location while reading MTD partition (diff)
downloadandroid_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar.gz
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar.bz2
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar.lz
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar.xz
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.tar.zst
android_bootable_recovery-8e5e4dada713609c9b2c45ea9cf4572bb89ef761.zip
Diffstat (limited to '')
-rw-r--r--install.c4
-rw-r--r--mtdutils/mounts.c8
-rw-r--r--mtdutils/mounts.h2
-rw-r--r--mtdutils/mtdutils.c2
-rw-r--r--updater/updater.c4
5 files changed, 17 insertions, 3 deletions
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;
}
diff --git a/mtdutils/mounts.c b/mtdutils/mounts.c
index 2ab3ff60c..c90fc8acf 100644
--- a/mtdutils/mounts.c
+++ b/mtdutils/mounts.c
@@ -212,3 +212,11 @@ unmount_mounted_volume(const MountedVolume *volume)
}
return ret;
}
+
+int
+remount_read_only(const MountedVolume* volume)
+{
+ return mount(volume->device, volume->mount_point, volume->filesystem,
+ MS_NOATIME | MS_NODEV | MS_NODIRATIME |
+ MS_RDONLY | MS_REMOUNT, 0);
+}
diff --git a/mtdutils/mounts.h b/mtdutils/mounts.h
index 2e2765a93..30b2927c2 100644
--- a/mtdutils/mounts.h
+++ b/mtdutils/mounts.h
@@ -28,4 +28,6 @@ find_mounted_volume_by_mount_point(const char *mount_point);
int unmount_mounted_volume(const MountedVolume *volume);
+int remount_read_only(const MountedVolume* volume);
+
#endif // MTDUTILS_MOUNTS_H_
diff --git a/mtdutils/mtdutils.c b/mtdutils/mtdutils.c
index d16f44ef8..48d5ea9ab 100644
--- a/mtdutils/mtdutils.c
+++ b/mtdutils/mtdutils.c
@@ -455,7 +455,7 @@ static int write_block(MtdWriteContext *ctx, const char *data)
if (retry > 0) {
fprintf(stderr, "mtd: wrote block after %d retries\n", retry);
}
- fprintf(stderr, "mtd: successfully wrote block at %x\n", pos);
+ fprintf(stderr, "mtd: successfully wrote block at %llx\n", pos);
return 0; // Success!
}
diff --git a/updater/updater.c b/updater/updater.c
index 6537a94ba..aa626d29b 100644
--- a/updater/updater.c
+++ b/updater/updater.c
@@ -136,7 +136,9 @@ int main(int argc, char** argv) {
free(result);
}
- mzCloseZipArchive(&za);
+ if (updater_info.package_zip) {
+ mzCloseZipArchive(updater_info.package_zip);
+ }
free(script);
return 0;