From: Kevin Wolf Date: Mon, 8 Oct 2018 15:27:18 +0000 (+0200) Subject: curl: Support auto-read-only option X-Git-Tag: v3.1.0-rc0~8^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ceef36acb11819b255732b1de0ca62885da04bd;p=thirdparty%2Fqemu.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 fabb2b4da74..db5d2bd8efc 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) {