diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-10 15:39:27 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-01-14 10:06:56 +0100 |
commit | 8e895599a1beb250ebca00e83b5fae6a828d2171 (patch) | |
tree | ed9225cdb7e270d97a3a7ac9b96767fe17bf18d7 | |
parent | 63fb2590839162afdf14d7c0ee02d460766c0956 (diff) | |
download | qemu-8e895599a1beb250ebca00e83b5fae6a828d2171.tar.gz qemu-8e895599a1beb250ebca00e83b5fae6a828d2171.tar.bz2 qemu-8e895599a1beb250ebca00e83b5fae6a828d2171.zip |
block: do not probe zero-sized disks
A blank CD or DVD is visible as a zero-sized disks. Probing such
disks will lead to an EIO and a failure to start the VM. Treating
them as raw is a better solution.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -527,7 +527,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename, int ret = 0; /* Return the raw BlockDriver * to scsi-generic devices or empty drives */ - if (bs->sg || !bdrv_is_inserted(bs)) { + if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) { drv = bdrv_find_format("raw"); if (!drv) { ret = -ENOENT; |