From 4d0350fc38acc650595d8c1f53b80cfd44150172 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 12 Nov 2010 13:30:32 +0000 Subject: [PATCH] Remove bogus port handling code in virsh The "find-storage-pool-sources-as" command takes two arguments, a hostname and a port number. For some reason the code would also then look for a port number appended to the hostname string by searching for ':'. This totally breaks if the user gives an IPv6 address, and is redundant, since you can already provide a port as a separate argument * tools/virsh.c: Remove bogus port number handling code --- tools/virsh.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 1d0b6e4738..78a5c5b4ab 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5829,20 +5829,12 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED) return FALSE; if (host) { - size_t hostlen = strlen(host); char *port = vshCommandOptString(cmd, "port", &found); - if (!found) { - port = strrchr(host, ':'); - if (port) { - if (*(++port)) - hostlen = port - host - 1; - else - port = NULL; - } - } + if (!found) + port = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAddLit(&buf, "\n"); - virBufferVSprintf(&buf, " \n"); -- GitLab