Merge "first stage mount: abort when failed to parse fstab in device-tree"

am: d0d7346dc7

Change-Id: I46322f29c00a54bb6623eeb57c6fc3f076d942f0
This commit is contained in:
Bowgo Tsai 2017-11-11 01:51:14 +00:00 committed by android-build-merger
commit 9a9469faeb
2 changed files with 5 additions and 2 deletions

View file

@ -40,7 +40,7 @@ bool fs_mgr_update_for_slotselect(struct fstab *fstab) {
char *tmp; char *tmp;
if (ab_suffix.empty()) { if (ab_suffix.empty()) {
ab_suffix = fs_mgr_get_slot_suffix(); ab_suffix = fs_mgr_get_slot_suffix();
// Returns false as non A/B devices should not have MF_SLOTSELECT. // Return false if failed to get ab_suffix when MF_SLOTSELECT is specified.
if (ab_suffix.empty()) return false; if (ab_suffix.empty()) return false;
} }
if (asprintf(&tmp, "%s%s", fstab->recs[n].blk_device, ab_suffix.c_str()) > 0) { if (asprintf(&tmp, "%s%s", fstab->recs[n].blk_device, ab_suffix.c_str()) > 0) {

View file

@ -118,7 +118,10 @@ static bool inline IsRecoveryMode() {
FirstStageMount::FirstStageMount() FirstStageMount::FirstStageMount()
: need_dm_verity_(false), device_tree_fstab_(fs_mgr_read_fstab_dt(), fs_mgr_free_fstab) { : need_dm_verity_(false), device_tree_fstab_(fs_mgr_read_fstab_dt(), fs_mgr_free_fstab) {
if (!device_tree_fstab_) { if (!device_tree_fstab_) {
LOG(ERROR) << "Failed to read fstab from device tree"; // The client of FirstStageMount should check the existence of fstab in device-tree
// in advance, without parsing it. Reaching here means there is a FATAL error when
// parsing the fstab. So stop here to expose the failure.
LOG(FATAL) << "Failed to read fstab from device tree";
return; return;
} }
// Stores device_tree_fstab_->recs[] into mount_fstab_recs_ (vector<fstab_rec*>) // Stores device_tree_fstab_->recs[] into mount_fstab_recs_ (vector<fstab_rec*>)