浏览代码

Fix "Seek to .. failed" error with prefetch close to end of drive.

When a read to the last sector of the drive image was fully
satisfied from prefetch buffer, a seek error was mistakenly reported.

Related issue: #621
Petteri Aimonen 3 月之前
父节点
当前提交
7f2fb72423
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/BlueSCSI_disk.cpp

+ 2 - 1
src/BlueSCSI_disk.cpp

@@ -2045,7 +2045,8 @@ void scsiDiskStartRead(uint32_t lba, uint32_t blocks)
         }
 #endif
 
-        if (!img.file.seek((uint64_t)(transfer.lba + transfer.currentBlock) * bytesPerSector))
+        if (transfer.currentBlock < transfer.blocks &&
+            !img.file.seek((uint64_t)(transfer.lba + transfer.currentBlock) * bytesPerSector))
         {
             logmsg("Seek to ", transfer.lba, " failed for SCSI ID", (int)scsiDev.target->targetId);
             scsiDev.status = CHECK_CONDITION;