summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-05-11 06:44:46 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-05-11 06:44:46 +0200
commit2d7c9797c697c4514babf442a6abc6e5787b9e1f (patch)
treed178b16861f734db2daa34de7677e33c700cb2ad
parentMerge "otautil: Android.mk -> Android.bp" am: 106ca8e93f am: 46938bcf0c (diff)
parentMerge "recovery: Skip "/" in setup_install_mounts()." am: d7446c8eed (diff)
downloadandroid_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar.gz
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar.bz2
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar.lz
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar.xz
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.tar.zst
android_bootable_recovery-2d7c9797c697c4514babf442a6abc6e5787b9e1f.zip
Diffstat (limited to '')
-rw-r--r--roots.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/roots.cpp b/roots.cpp
index 727736b70..9b4270256 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -260,26 +260,29 @@ int format_volume(const char* volume) {
}
int setup_install_mounts() {
- if (fstab == NULL) {
- LOG(ERROR) << "can't set up install mounts: no fstab loaded";
- return -1;
- }
- for (int i = 0; i < fstab->num_entries; ++i) {
- Volume* v = fstab->recs + i;
+ if (fstab == nullptr) {
+ LOG(ERROR) << "can't set up install mounts: no fstab loaded";
+ return -1;
+ }
+ for (int i = 0; i < fstab->num_entries; ++i) {
+ const Volume* v = fstab->recs + i;
- if (strcmp(v->mount_point, "/tmp") == 0 ||
- strcmp(v->mount_point, "/cache") == 0) {
- if (ensure_path_mounted(v->mount_point) != 0) {
- LOG(ERROR) << "failed to mount " << v->mount_point;
- return -1;
- }
+ // We don't want to do anything with "/".
+ if (strcmp(v->mount_point, "/") == 0) {
+ continue;
+ }
- } else {
- if (ensure_path_unmounted(v->mount_point) != 0) {
- LOG(ERROR) << "failed to unmount " << v->mount_point;
- return -1;
- }
- }
+ if (strcmp(v->mount_point, "/tmp") == 0 || strcmp(v->mount_point, "/cache") == 0) {
+ if (ensure_path_mounted(v->mount_point) != 0) {
+ LOG(ERROR) << "failed to mount " << v->mount_point;
+ return -1;
+ }
+ } else {
+ if (ensure_path_unmounted(v->mount_point) != 0) {
+ LOG(ERROR) << "failed to unmount " << v->mount_point;
+ return -1;
+ }
}
- return 0;
+ }
+ return 0;
}