From 73ad20e936b0fc9fac59efb66e6f77a5739aab4b Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Mon, 15 Jun 2015 11:28:11 +0200 Subject: [PATCH] Generate JSON with mDNS entries only when built --with-avahi 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 --- tests/virnetservertest.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/virnetservertest.c b/tests/virnetservertest.c index 596fabedd3..e8e91f867e 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)