From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCR0x-0008PD-1D for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCR0n-0007iv-Ms for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:26 -0500 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:53311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCR0n-0007il-Fe for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:17 -0500 Received: by mail-ea0-f178.google.com with SMTP id a15so2433153eae.9 for ; Sun, 09 Feb 2014 01:49:16 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sun, 9 Feb 2014 10:48:42 +0100 Message-Id: <1391939335-31580-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> References: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 07/20] gluster: default scheme to gluster:// and host to localhost. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, mreitz@redhat.com Currently, "gluster:///volname/img" and (using file. options) "file.driver=gluster,file.filename=foo" will segfault. Also, "//host/volname/img" will be rejected, but it is a valid URL that should be accepted just fine with "file.driver=gluster". Accept all of these, by inferring missing transport and host as TCP and localhost respectively. Signed-off-by: Paolo Bonzini --- block/gluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index a009b15..f9dd37f 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -127,7 +127,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) } /* transport */ - if (!strcmp(uri->scheme, "gluster")) { + if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { gconf->transport = g_strdup("tcp"); } else if (!strcmp(uri->scheme, "gluster+tcp")) { gconf->transport = g_strdup("tcp"); @@ -163,7 +163,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) } gconf->server = g_strdup(qp->p[0].value); } else { - gconf->server = g_strdup(uri->server); + gconf->server = g_strdup(uri->server ? uri->server : "localhost"); gconf->port = uri->port; } -- 1.8.5.3