From 652cfb7caf8c0c7ac35043bb56746ef96dfb7c6d Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Mon, 13 Feb 2012 21:04:50 +0100
Subject: zeroconf: skip initialisation if there is no port

---
 src/zeroconf.c | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src/zeroconf.c')

diff --git a/src/zeroconf.c b/src/zeroconf.c
index 907eb8bfc..4a399e4a2 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -21,6 +21,7 @@
 #include "zeroconf.h"
 #include "zeroconf-internal.h"
 #include "conf.h"
+#include "listen.h"
 
 #include <glib.h>
 
@@ -42,6 +43,12 @@ void initZeroconf(void)
 	if (!zeroconfEnabled)
 		return;
 
+	if (listen_port <= 0) {
+		g_warning("No global port, disabling zeroconf");
+		zeroconfEnabled = false;
+		return;
+	}
+
 	serviceName = config_get_string(CONF_ZEROCONF_NAME, SERVICE_NAME);
 
 #ifdef HAVE_AVAHI
-- 
cgit v1.2.3