diff options
author | Johan Harvyl <johan.harvyl@sonymobile.com> | 2016-08-15 20:16:06 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-08-15 20:16:06 +0200 |
commit | bebe94b105869c8c745965f0f3f5c3fcf13d1813 (patch) | |
tree | 7ac7aa45a571feef3f218c3fdcb45ff2fd2032e9 | |
parent | Add inttypes.h for PRIu64. am: 53c107f068 am: 0d345b6731 (diff) | |
parent | Merge "Format formattable partitions if mount fails" am: cb76857147 am: 2f5cfdbb9d (diff) | |
download | android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar.gz android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar.bz2 android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar.lz android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar.xz android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.tar.zst android_bootable_recovery-bebe94b105869c8c745965f0f3f5c3fcf13d1813.zip |
Diffstat (limited to '')
-rw-r--r-- | roots.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -102,7 +102,20 @@ int ensure_path_mounted_at(const char* path, const char* mount_point) { if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "squashfs") == 0 || strcmp(v->fs_type, "vfat") == 0) { - if (mount(v->blk_device, mount_point, v->fs_type, v->flags, v->fs_options) == -1) { + int result = mount(v->blk_device, mount_point, v->fs_type, v->flags, v->fs_options); + if (result == -1 && fs_mgr_is_formattable(v)) { + LOGE("failed to mount %s (%s), formatting ...\n", + mount_point, strerror(errno)); + bool crypt_footer = fs_mgr_is_encryptable(v) && !strcmp(v->key_loc, "footer"); + if (fs_mgr_do_format(v, crypt_footer) == 0) { + result = mount(v->blk_device, mount_point, v->fs_type, v->flags, v->fs_options); + } else { + LOGE("failed to format %s (%s)\n", mount_point, strerror(errno)); + return -1; + } + } + + if (result == -1) { LOGE("failed to mount %s (%s)\n", mount_point, strerror(errno)); return -1; } |