* [Qemu-devel] [PATCH] 2/5: open() can also return EPERM for O_RDWR on a readonly device
@ 2008-10-01 18:36 Juergen Lock
2008-10-13 21:08 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Juergen Lock @ 2008-10-01 18:36 UTC (permalink / raw)
To: qemu-devel
..at least on FreeBSD. (I think the case where this happened was a cdrom.)
Index: qemu/block.c
@@ -381,7 +381,7 @@
else
open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
ret = drv->bdrv_open(bs, filename, open_flags);
- if (ret == -EACCES && !(flags & BDRV_O_FILE)) {
+ if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY);
bs->read_only = 1;
}
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] 2/5: open() can also return EPERM for O_RDWR on a readonly device
2008-10-01 18:36 [Qemu-devel] [PATCH] 2/5: open() can also return EPERM for O_RDWR on a readonly device Juergen Lock
@ 2008-10-13 21:08 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2008-10-13 21:08 UTC (permalink / raw)
To: qemu-devel
Applied, thanks.
On Wed, Oct 01, 2008 at 08:36:09PM +0200, Juergen Lock wrote:
> ..at least on FreeBSD. (I think the case where this happened was a cdrom.)
>
> Index: qemu/block.c
> @@ -381,7 +381,7 @@
> else
> open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
> ret = drv->bdrv_open(bs, filename, open_flags);
> - if (ret == -EACCES && !(flags & BDRV_O_FILE)) {
> + if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
> ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY);
> bs->read_only = 1;
> }
>
> Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
>
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-13 21:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-01 18:36 [Qemu-devel] [PATCH] 2/5: open() can also return EPERM for O_RDWR on a readonly device Juergen Lock
2008-10-13 21:08 ` Aurelien Jarno
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).