diff mbox

[v2] block/curl.c: Refuse to open the handle for writes.

Message ID 1370864323-25679-2-git-send-email-rjones@redhat.com
State New
Headers show

Commit Message

Richard W.M. Jones June 10, 2013, 11:38 a.m. UTC
From: "Richard W.M. Jones" <rjones@redhat.com>

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/curl.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kevin Wolf June 10, 2013, 11:56 a.m. UTC | #1
Am 10.06.2013 um 13:38 hat Richard W.M. Jones geschrieben:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block/curl.c b/block/curl.c
index b8935fd..b634ccf 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -406,6 +406,12 @@  static int curl_open(BlockDriverState *bs, QDict *options, int flags)
 
     static int inited = 0;
 
+    if (flags & BDRV_O_RDWR) {
+        qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                      "curl block device does not support writes");
+        return -EROFS;
+    }
+
     opts = qemu_opts_create_nofail(&runtime_opts);
     qemu_opts_absorb_qdict(opts, options, &local_err);
     if (error_is_set(&local_err)) {