From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KpUeq-0000Qn-C7 for qemu-devel@nongnu.org; Mon, 13 Oct 2008 17:08:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KpUep-0000QI-S1 for qemu-devel@nongnu.org; Mon, 13 Oct 2008 17:08:51 -0400 Received: from [199.232.76.173] (port=50367 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpUep-0000QA-GH for qemu-devel@nongnu.org; Mon, 13 Oct 2008 17:08:51 -0400 Received: from hall.aurel32.net ([88.191.82.174]:33211) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KpUep-0005nw-1Z for qemu-devel@nongnu.org; Mon, 13 Oct 2008 17:08:51 -0400 Received: from volta-wlan.aurel32.net ([2002:52e8:2fb:ffff:21d:e0ff:fe49:1047] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KpUen-0003bi-Of for qemu-devel@nongnu.org; Mon, 13 Oct 2008 23:08:49 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1KpUei-0006OB-2q for qemu-devel@nongnu.org; Mon, 13 Oct 2008 23:08:44 +0200 Date: Mon, 13 Oct 2008 23:08:44 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] 2/5: open() can also return EPERM for O_RDWR on a readonly device Message-ID: <20081013210844.GC18008@volta.aurel32.net> References: <20081001183609.GA70515@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20081001183609.GA70515@saturn.kn-bremen.de> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net