aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-06-01 18:37:31 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-04 11:43:40 +0200
commit08a00559f00975cebcb3f844fe7c708d65b6a3b3 (patch)
treeda79452d03ca6e088c3a1bd611c7fdae374056da /block.c
parent236f1f672ca4b5dea70c0c101036224297c53895 (diff)
block: Assume raw for drives without media
qemu -cdrom /dev/cdrom with an empty CD-ROM drive doesn't work any more because we try to guess the format and when this fails (because there is no medium) we exit with an error message. This patch should restore the old behaviour by assuming raw format for such drives. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block.c b/block.c
index 9c43332f4f..ecd98675a5 100644
--- a/block.c
+++ b/block.c
@@ -331,8 +331,8 @@ static BlockDriver *find_image_format(const char *filename)
if (ret < 0)
return NULL;
- /* Return the raw BlockDriver * to scsi-generic devices */
- if (bs->sg) {
+ /* Return the raw BlockDriver * to scsi-generic devices or empty drives */
+ if (bs->sg || !bdrv_is_inserted(bs)) {
bdrv_delete(bs);
return bdrv_find_format("raw");
}