Commit 54421cb17bc744bad15f2b1adb4adefdaea83c10

Authored by ths
1 parent 0da75eb1

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
Showing 1 changed file with 12 additions and 2 deletions
block-raw.c
... ... @@ -914,8 +914,13 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
914 914 s->hfile = CreateFile(filename, access_flags,
915 915 FILE_SHARE_READ, NULL,
916 916 create_flags, overlapped, NULL);
917   - if (s->hfile == INVALID_HANDLE_VALUE)
  917 + if (s->hfile == INVALID_HANDLE_VALUE) {
  918 + int err = GetLastError();
  919 +
  920 + if (err == ERROR_ACCESS_DENIED)
  921 + return -EACCES;
918 922 return -1;
  923 + }
919 924 return 0;
920 925 }
921 926  
... ... @@ -1278,8 +1283,13 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
1278 1283 s->hfile = CreateFile(filename, access_flags,
1279 1284 FILE_SHARE_READ, NULL,
1280 1285 create_flags, overlapped, NULL);
1281   - if (s->hfile == INVALID_HANDLE_VALUE)
  1286 + if (s->hfile == INVALID_HANDLE_VALUE) {
  1287 + int err = GetLastError();
  1288 +
  1289 + if (err == ERROR_ACCESS_DENIED)
  1290 + return -EACCES;
1282 1291 return -1;
  1292 + }
1283 1293 return 0;
1284 1294 }
1285 1295  
... ...