diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2010-11-12 13:30:32 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2010-11-23 15:00:35 +0000 |
commit | 4d0350fc38acc650595d8c1f53b80cfd44150172 (patch) | |
tree | 82bdfaed3b839f0e02f0a92bb8e726987f2349f2 | |
parent | Allow iSCSI IQN to be set with find-storage-pool-sources-as command (diff) | |
download | libvirt-4d0350fc38acc650595d8c1f53b80cfd44150172.tar.gz libvirt-4d0350fc38acc650595d8c1f53b80cfd44150172.tar.bz2 libvirt-4d0350fc38acc650595d8c1f53b80cfd44150172.zip |
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
-rw-r--r-- | tools/virsh.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tools/virsh.c b/tools/virsh.c index 1d0b6e473..78a5c5b4a 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, "<source>\n"); - virBufferVSprintf(&buf, " <host name='%.*s'",(int)hostlen, host); + virBufferVSprintf(&buf, " <host name='%s'", host); if (port) virBufferVSprintf(&buf, " port='%s'", port); virBufferAddLit(&buf, "/>\n"); |