Merge "recovery: Skip "/" in setup_install_mounts()." am: d7446c8eed am: b0626221a1 am: 8c7c38ca7f

am: 2d7c9797c6

Change-Id: I00148c23b353352f47bd6824022e0594122be025
This commit is contained in:
Tao Bao
2017-05-11 05:22:15 +00:00
committed by android-build-merger
+23 -20
View File
@@ -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";
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;
// We don't want to do anything with "/".
if (strcmp(v->mount_point, "/") == 0) {
continue;
}
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;
}
}
for (int i = 0; i < fstab->num_entries; ++i) {
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;
}
} else {
if (ensure_path_unmounted(v->mount_point) != 0) {
LOG(ERROR) << "failed to unmount " << v->mount_point;
return -1;
}
}
}
return 0;
}
return 0;
}