Patchwork block/curl.c: Refuse to open the handle for writes.

login
register
mail settings
Submitter Richard W.M. Jones
Date May 22, 2013, 3:01 p.m.
Message ID <1369234881-403-1-git-send-email-rjones@redhat.com>
Download mbox | patch
Permalink /patch/245642/
State New
Headers show

Comments

Richard W.M. Jones - May 22, 2013, 3:01 p.m.
From: "Richard W.M. Jones" <rjones@redhat.com>

---
 block/curl.c | 4 ++++
 1 file changed, 4 insertions(+)
Fam Zheng - May 23, 2013, 12:39 a.m.
On Wed, 05/22 16:01, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> ---
>  block/curl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/curl.c b/block/curl.c
> index b8935fd..f1e302b 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -406,6 +406,10 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags)
>  
>      static int inited = 0;
>  
> +    if (flags & BDRV_O_RDWR) {
> +        return -ENOTSUP;
> +    }
> +
>      opts = qemu_opts_create_nofail(&runtime_opts);
>      qemu_opts_absorb_qdict(opts, options, &local_err);
>      if (error_is_set(&local_err)) {
> -- 
> 1.8.2.1
> 

Thanks, I'll include this in the new version of my series.

Patch

diff --git a/block/curl.c b/block/curl.c
index b8935fd..f1e302b 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -406,6 +406,10 @@  static int curl_open(BlockDriverState *bs, QDict *options, int flags)
 
     static int inited = 0;
 
+    if (flags & BDRV_O_RDWR) {
+        return -ENOTSUP;
+    }
+
     opts = qemu_opts_create_nofail(&runtime_opts);
     qemu_opts_absorb_qdict(opts, options, &local_err);
     if (error_is_set(&local_err)) {