* [Qemu-devel][PATCH] CD-ROM read-only fix for win32
@ 2007-01-15 4:32 Kazu
0 siblings, 0 replies; only message in thread
From: Kazu @ 2007-01-15 4:32 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 260 bytes --]
Hi,
When a file has a read-only attribute for its property, the program doesn't
boot. An attached patch fixes it. For example, read-only CD-ROM file can be
used.
It also fixes the problem that restricted user can't access host's CD-ROM
drive.
Thanks,
Kazu
[-- Attachment #2: qemu-20070114-cdrom.patch --]
[-- Type: application/octet-stream, Size: 1163 bytes --]
Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.16
diff -u -r1.16 block-raw.c
--- block-raw.c 7 Jan 2007 22:43:30 -0000 1.16
+++ block-raw.c 14 Jan 2007 05:07:17 -0000
@@ -914,8 +914,13 @@
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 @@
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-15 4:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-15 4:32 [Qemu-devel][PATCH] CD-ROM read-only fix for win32 Kazu
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).