[v4,1/4] fdc: fix implied seek while there is no medina in drive

Submitted by Pavel Hrdina on June 13, 2012, 12:45 p.m.

Details

Message ID 98b829a7de36510287b95bf4dcfd3c545d369a9b.1339591287.git.phrdina@redhat.com
State New
Headers show

Commit Message

Pavel Hrdina June 13, 2012, 12:45 p.m.
The Windows uses 'READ' command at the start of an instalation
without checking the 'dir' register. We have to abort the transfer
with an abnormal termination if there is no media in the drive.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/fdc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/fdc.c b/hw/fdc.c
index 30d34e3..be35201 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -159,6 +159,10 @@  static int fd_seek(FDrive *drv, uint8_t head, uint8_t track, uint8_t sect,
         drv->sect = sect;
     }
 
+    if (drv->bs == NULL || !bdrv_is_inserted(drv->bs)) {
+        ret = 2;
+    }
+
     return ret;
 }