[PATCH 3/4] Generate JSON with mDNS entries only when built --with-avahi

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

 



One string was already used only if that condition was true, second one
is added now.  Both are used in a nicer way.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 tests/virnetservertest.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tests/virnetservertest.c b/tests/virnetservertest.c
index 596fabedd38b..e8e91f867e45 100644
--- a/tests/virnetservertest.c
+++ b/tests/virnetservertest.c
@@ -35,6 +35,13 @@ testCreateServer(const char *host, int family)
     virNetServerClientPtr cln1 = NULL, cln2 = NULL;
     virNetSocketPtr sk1 = NULL, sk2 = NULL;
     int fdclient[2];
+    const char *mdns_entry = NULL;
+    const char *mdns_group = NULL;
+
+# ifdef WITH_AVAHI
+    mdns_entry = "libvirt-ro";
+    mdns_group = "libvirtTest";
+# endif

     if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
         virReportSystemError(errno, "%s",
@@ -44,11 +51,7 @@ testCreateServer(const char *host, int family)

     if (!(srv = virNetServerNew(10, 50, 5, 100, 10,
                                 120, 5, true,
-# ifdef WITH_AVAHI
-                                "libvirtTest",
-# else
-                                NULL,
-# endif
+                                mdns_group,
                                 NULL,
                                 NULL,
                                 NULL,
@@ -79,9 +82,9 @@ testCreateServer(const char *host, int family)
                                            5)))
         goto error;

-    if (virNetServerAddService(srv, svc1, "libvirt-ro") < 0)
+    if (virNetServerAddService(srv, svc1, mdns_entry) < 0)
         goto error;
-    if (virNetServerAddService(srv, svc2, "libvirt-ro") < 0)
+    if (virNetServerAddService(srv, svc2, mdns_entry) < 0)
         goto error;

     if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
-- 
2.4.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]