aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-06-01 20:32:35 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-04 11:43:40 +0200
commit552fee931bf52bf60f4210f607a78f415000f015 (patch)
tree24bc7b5203ebc192e8f07b5ef49cb792a23c4efc /hw/scsi-disk.c
parenta0fef654f6dec1348a074a17a6b809d0ba77b34e (diff)
scsi: Fix info qtree for scsi-disk.ver
Show the actual default value instead of <null> when the property has not been set. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index e8c066adff..a3559d1fcd 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -462,8 +462,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
}
memcpy(&outbuf[8], "QEMU ", 8);
memset(&outbuf[32], 0, 4);
- memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION,
- MIN(4, strlen(s->version ? s->version : QEMU_VERSION)));
+ memcpy(&outbuf[32], s->version, MIN(4, strlen(s->version)));
/*
* We claim conformance to SPC-3, which is required for guests
* to ask for modern features like READ CAPACITY(16) or the
@@ -1066,6 +1065,10 @@ static int scsi_disk_initfn(SCSIDevice *dev)
}
}
+ if (!s->version) {
+ s->version = qemu_strdup(QEMU_VERSION);
+ }
+
if (bdrv_is_sg(s->bs)) {
error_report("scsi-disk: unwanted /dev/sg*");
return -1;