On Wed, May 22, 2013 at 01:04:51PM +0200, Paolo Bonzini wrote:
> Something is trying to write, but there's no write operation defined for
> CURL.
> 
> I guess curl (and other backends too) should reject being opened for
> write.  Alternatively, block.c could do that for them.

Yes, I'd just got to that conclusion as well :-)

The attached patch fixes the crash for me.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
From 0d42755f009c142b85fb07a06a41cee6c7ea68ba Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjo...@redhat.com>
Date: Wed, 22 May 2013 12:11:45 +0100
Subject: [PATCH] block/curl.c: Refuse to open the handle for writes.

---
 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

Reply via email to