* [Qemu-devel] [PATCH] Fix error message in drive_init
@ 2010-06-01 11:24 Kevin Wolf
0 siblings, 0 replies; only message in thread
From: Kevin Wolf @ 2010-06-01 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
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>
---
vl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index 7f84af8..551138f 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;
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-01 11:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01 11:24 [Qemu-devel] [PATCH] Fix error message in drive_init Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).