diff mbox

[36/39] fdc: fix implied seek while there is no media in drive

Message ID 1339767219-24297-37-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf June 15, 2012, 1:33 p.m. UTC
From: Pavel Hrdina <phrdina@redhat.com>

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>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/fdc.c b/hw/fdc.c
index bfa4e68..78b4e33 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;
 }