Flush the cache on STOP UNIT (#644)

This commit is contained in:
Uwe Seimet 2022-02-06 20:44:28 +01:00 committed by GitHub
parent 36cadd78fc
commit 9d0d78a643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -1293,16 +1293,21 @@ bool Disk::StartStop(const DWORD *cdb)
SetStopped(!start);
}
// Look at the eject bit and eject if necessary
if (load && !start) {
if (IsLocked()) {
// Cannot be ejected because it is locked
SetStatusCode(STATUS_PREVENT);
return false;
}
if (!start) {
// Flush the cache when stopping
disk.dcache->Save();
// Eject
return Eject(false);
// Look at the eject bit and eject if necessary
if (load) {
if (IsLocked()) {
// Cannot be ejected because it is locked
SetStatusCode(STATUS_PREVENT);
return false;
}
// Eject
return Eject(false);
}
}
return true;