qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2] block/curl.c: Refuse to open the handle for writ


From: Richard W.M. Jones
Subject: [Qemu-devel] [PATCH v2] block/curl.c: Refuse to open the handle for writes.
Date: Mon, 10 Jun 2013 12:38:43 +0100

From: "Richard W.M. Jones" <address@hidden>

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

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)) {
-- 
1.8.2.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]