|
|
9ae3a8 |
From 96aa5a9a7d0dc4bb47e421168857eacbb36065a8 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 4 Nov 2013 22:32:21 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 28/87] block/raw-win32: Always use -errno in hdev_open
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383604354-12743-31-git-send-email-mreitz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55330
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 30/43] block/raw-win32: Always use -errno in hdev_open
|
|
|
9ae3a8 |
Bugzilla: 1026524
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: 1026524
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
On one occasion, hdev_open() returned -1 in case of an unknown error
|
|
|
9ae3a8 |
instead of a proper -errno value. Adjust this to match the behavior of
|
|
|
9ae3a8 |
raw_open() (in raw-win32), which is to return -EINVAL in this case.
|
|
|
9ae3a8 |
Also, change the call to error_setg*() to match the one in raw_open() as
|
|
|
9ae3a8 |
well.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 45d57f6e718e44e55780bcf1d09fa140dce7ec08)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/raw-win32.c | 5 ++---
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/raw-win32.c | 5 ++---
|
|
|
9ae3a8 |
1 files changed, 2 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/raw-win32.c b/block/raw-win32.c
|
|
|
9ae3a8 |
index 5a60ca5..3e0251f 100644
|
|
|
9ae3a8 |
--- a/block/raw-win32.c
|
|
|
9ae3a8 |
+++ b/block/raw-win32.c
|
|
|
9ae3a8 |
@@ -587,12 +587,11 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
int err = GetLastError();
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (err == ERROR_ACCESS_DENIED) {
|
|
|
9ae3a8 |
- error_setg_errno(errp, EACCES, "Could not open device");
|
|
|
9ae3a8 |
ret = -EACCES;
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
- error_setg(errp, "Could not open device");
|
|
|
9ae3a8 |
- ret = -1;
|
|
|
9ae3a8 |
+ ret = -EINVAL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+ error_setg_errno(errp, -ret, "Could not open device");
|
|
|
9ae3a8 |
goto done;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|