Skip to contentSkip to conversation

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

PATCH Superseded Richard W.M. Jones 2 participants 3 messages Jun 10, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block/curl.c: Refuse to open the handle for writes.

v2:

- Use qerror_report to report an error.
- Return -EROFS instead of -ENOTSUP.

#1 lore raw

PATCH v2 1/1 block/curl.c: Refuse to open the handle for writes.

From: "Richard W.M. Jones" <[email protected]>

---
 block/curl.c | 6 ++++++
 1 file changed, 6 insertions(+)
block/curl.c +6 -0
index b8935fd..b634ccf 100644
@@ -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)) {
Signature · 1 line
1.8.2.1