init: call umount unconditionally
std::all_of is using std::find_if, which means, if any element the given predicate returns false, it stops further iteration and just returns false. std::all_of used in Reboot.cpp will cause umount not to be called on all block devices if some block device returns false in the middle. Bug: 68158923 Test: reboot Change-Id: I43ba6bd0c18018c1ed5fe2b63996552bc51cc67c
This commit is contained in:
parent
c2a2ecb7a5
commit
25dc30f3be
1 changed files with 6 additions and 6 deletions
|
@ -280,16 +280,16 @@ static UmountStat UmountPartitions(std::chrono::milliseconds timeout) {
|
|||
}
|
||||
bool unmount_done = true;
|
||||
if (emulated_devices.size() > 0) {
|
||||
unmount_done = std::all_of(emulated_devices.begin(), emulated_devices.end(),
|
||||
[](auto& entry) { return entry.Umount(false); });
|
||||
for (auto& entry : emulated_devices) {
|
||||
if (!entry.Umount(false)) unmount_done = false;
|
||||
}
|
||||
if (unmount_done) {
|
||||
sync();
|
||||
}
|
||||
}
|
||||
unmount_done =
|
||||
std::all_of(block_devices.begin(), block_devices.end(),
|
||||
[&timeout](auto& entry) { return entry.Umount(timeout == 0ms); }) &&
|
||||
unmount_done;
|
||||
for (auto& entry : block_devices) {
|
||||
if (!entry.Umount(timeout == 0ms)) unmount_done = false;
|
||||
}
|
||||
if (unmount_done) {
|
||||
return UMOUNT_STAT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue