[PATCH 07/11] Remove bogus port handling code in virsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 69a42e8..a840758 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5772,15 +5772,8 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
     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);
-- 
1.7.2.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]