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>
const char *devaddr;
DriveInfo *dinfo;
int snapshot = 0;
+ int ret;
*fatal_error = 1;
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;
}