summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-06-01 13:20:57 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-04 11:43:40 +0200
commit236f1f672ca4b5dea70c0c101036224297c53895 (patch)
treeab5bcbda842edad2487a521711c64de390b5d199 /vl.c
parent552fee931bf52bf60f4210f607a78f415000f015 (diff)
downloadqemu-236f1f672ca4b5dea70c0c101036224297c53895.tar.gz
Fix error message in drive_init
The real error is the return value of bdrv_open. errno might be overwritten or not even set to that value in the first place. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index 76a9b25569..2769d1a4bc 100644
--- a/vl.c
+++ b/vl.c
@@ -789,6 +789,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
const char *devaddr;
DriveInfo *dinfo;
int snapshot = 0;
+ int ret;
*fatal_error = 1;
@@ -1119,9 +1120,10 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
- if (bdrv_open(dinfo->bdrv, file, bdrv_flags, drv) < 0) {
+ ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv);
+ if (ret < 0) {
fprintf(stderr, "qemu: could not open disk image %s: %s\n",
- file, strerror(errno));
+ file, strerror(-ret));
return NULL;
}