aboutsummaryrefslogtreecommitdiff
path: root/block/curl.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-10-08 17:27:18 +0200
committerKevin Wolf <kwolf@redhat.com>2018-11-05 15:09:55 +0100
commit6ceef36acb11819b255732b1de0ca62885da04bd (patch)
tree0aa6ce085dff31ea3512935a9be5bca5e0e7798a /block/curl.c
parent64107dc044a54ebe46348ac0fe87584be2eb3e81 (diff)
curl: Support auto-read-only option
If read-only=off, but auto-read-only=on is given, just degrade to read-only. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/curl.c')
-rw-r--r--block/curl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/curl.c b/block/curl.c
index fabb2b4da7..db5d2bd8ef 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -684,10 +684,10 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
const char *protocol_delimiter;
int ret;
-
- if (flags & BDRV_O_RDWR) {
- error_setg(errp, "curl block device does not support writes");
- return -EROFS;
+ ret = bdrv_apply_auto_read_only(bs, "curl driver does not support writes",
+ errp);
+ if (ret < 0) {
+ return ret;
}
if (!libcurl_initialized) {