mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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
This commit is contained in:
parent
9a7caeffdf
commit
4d0350fc38
@ -5829,20 +5829,12 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
size_t hostlen = strlen(host);
|
|
||||||
char *port = vshCommandOptString(cmd, "port", &found);
|
char *port = vshCommandOptString(cmd, "port", &found);
|
||||||
if (!found) {
|
if (!found)
|
||||||
port = strrchr(host, ':');
|
port = NULL;
|
||||||
if (port) {
|
|
||||||
if (*(++port))
|
|
||||||
hostlen = port - host - 1;
|
|
||||||
else
|
|
||||||
port = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
virBufferAddLit(&buf, "<source>\n");
|
virBufferAddLit(&buf, "<source>\n");
|
||||||
virBufferVSprintf(&buf, " <host name='%.*s'",(int)hostlen, host);
|
virBufferVSprintf(&buf, " <host name='%s'", host);
|
||||||
if (port)
|
if (port)
|
||||||
virBufferVSprintf(&buf, " port='%s'", port);
|
virBufferVSprintf(&buf, " port='%s'", port);
|
||||||
virBufferAddLit(&buf, "/>\n");
|
virBufferAddLit(&buf, "/>\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user