Received: from [140.186.70.92] (port=43021 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POCQI-000247-Fx for qemu-devel@nongnu.org; Thu, 02 Dec 2010 11:54:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POCQH-0006oF-FJ for qemu-devel@nongnu.org; Thu, 02 Dec 2010 11:54:22 -0500 Received: from mtagate5.uk.ibm.com ([194.196.100.165]:37281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POCQH-0006nu-6H for qemu-devel@nongnu.org; Thu, 02 Dec 2010 11:54:21 -0500 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id oB2GsJ9s030805 for ; Thu, 2 Dec 2010 16:54:19 GMT Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB2GsM9f3059810 for ; Thu, 2 Dec 2010 16:54:24 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB2GsHcg030120 for ; Thu, 2 Dec 2010 09:54:17 -0700 From: Stefan Hajnoczi Date: Thu, 2 Dec 2010 16:54:13 +0000 Message-Id: <1291308853-11011-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2] block: Fix the use of protocols in backing files List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi Backing filenames may contain a protocol. The code currently doesn't consider this case and produces filenames that embed ":". Don't combine filenames if the backing filename contains a protocol. Based on an earlier patch by Anthony Liguori . Signed-off-by: Stefan Hajnoczi --- block.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) v2: * Make backing_format + protocol work diff --git a/block.c b/block.c index 59b69e4..de13d1f 100644 --- a/block.c +++ b/block.c @@ -611,10 +611,18 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *back_drv = NULL; bs->backing_hd = bdrv_new(""); - path_combine(backing_filename, sizeof(backing_filename), - filename, bs->backing_file); - if (bs->backing_format[0] != '\0') + + if (path_has_protocol(bs->backing_file)) { + pstrcpy(backing_filename, sizeof(backing_filename), + bs->backing_file); + } else { + path_combine(backing_filename, sizeof(backing_filename), + filename, bs->backing_file); + } + + if (bs->backing_format[0] != '\0') { back_drv = bdrv_find_format(bs->backing_format); + } /* backing files always opened read-only */ back_flags = -- 1.7.2.3