From: Kevin Wolf Date: Mon, 8 Oct 2018 15:27:18 +0000 (+0200) Subject: curl: Support auto-read-only option X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6ceef36acb11819b255732b1de0ca62885da04bd;p=qemu.git 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 Reviewed-by: Eric Blake --- 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) {