diff mbox

[v12,03/16] qemu-io: Set "share-rw" flag together with read-only

Message ID 20170123123056.30383-4-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Jan. 23, 2017, 12:30 p.m. UTC
qemu-io is a low level tool to read or modify guest visible data, which
implies the user knows very well what is being done. Allowing reading
from a locked image is harmless in most cases, so do it.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 qemu-io.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Max Reitz Feb. 5, 2017, 9:52 p.m. UTC | #1
On 23.01.2017 13:30, Fam Zheng wrote:
> qemu-io is a low level tool to read or modify guest visible data, which
> implies the user knows very well what is being done. Allowing reading
> from a locked image is harmless in most cases, so do it.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  qemu-io.c | 2 ++
>  1 file changed, 2 insertions(+)

What about open_f()?

Max
Fam Zheng Feb. 6, 2017, 4:52 a.m. UTC | #2
On Sun, 02/05 22:52, Max Reitz wrote:
> On 23.01.2017 13:30, Fam Zheng wrote:
> > qemu-io is a low level tool to read or modify guest visible data, which
> > implies the user knows very well what is being done. Allowing reading
> > from a locked image is harmless in most cases, so do it.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  qemu-io.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> What about open_f()?

Right, should do the same.

Fam
diff mbox

Patch

diff --git a/qemu-io.c b/qemu-io.c
index 23a229f..f000504 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -585,6 +585,8 @@  int main(int argc, char **argv)
     /* open the device */
     if (!readonly) {
         flags |= BDRV_O_RDWR;
+    } else {
+        flags |= BDRV_O_SHARE_RW;
     }
 
     if ((argc - optind) == 1) {