aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-18 00:22:11 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-18 00:22:11 +0000
commit54421cb17bc744bad15f2b1adb4adefdaea83c10 (patch)
tree2f5bca5e34298da3f4ce0b34f25eff59164faf3e
parent0da75eb13524d5aa426486d015d63e1b6ce34aa2 (diff)
Fix CDROM permission check, by Kazu <kazoo@r3.dion.ne.jp>.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2331 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--block-raw.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/block-raw.c b/block-raw.c
index 2b6f441bad..29882e1f70 100644
--- a/block-raw.c
+++ b/block-raw.c
@@ -914,8 +914,13 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
create_flags, overlapped, NULL);
- if (s->hfile == INVALID_HANDLE_VALUE)
+ if (s->hfile == INVALID_HANDLE_VALUE) {
+ int err = GetLastError();
+
+ if (err == ERROR_ACCESS_DENIED)
+ return -EACCES;
return -1;
+ }
return 0;
}
@@ -1278,8 +1283,13 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
create_flags, overlapped, NULL);
- if (s->hfile == INVALID_HANDLE_VALUE)
+ if (s->hfile == INVALID_HANDLE_VALUE) {
+ int err = GetLastError();
+
+ if (err == ERROR_ACCESS_DENIED)
+ return -EACCES;
return -1;
+ }
return 0;
}