aboutsummaryrefslogtreecommitdiffstats
path: root/src/zeroconf.c
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-06-03 19:25:25 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-06-03 19:25:25 +0000
commita6fecd6c05b07bd5238bbace2098105e9e1e8c66 (patch)
treeb85e269da129c9d4554e85ef190ddc1e121279a6 /src/zeroconf.c
parentd67737bc6499545e2a372b732a578ebc28128cc2 (diff)
downloadmpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.tar.gz
mpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.tar.xz
mpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.zip
Making some bool options more consistent.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/zeroconf.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/zeroconf.c b/src/zeroconf.c
index 6dca7e10b..cb2f8abc6 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -36,6 +36,10 @@
*/
#define SERVICE_NAME "Music Player"
+#define DEFAULT_ZEROCONF_ENABLED 1
+
+static zeroconfEnabled;
+
static struct ioOps zeroConfIo = {
};
@@ -549,9 +553,14 @@ void initZeroconf(void)
{
const char* serviceName = SERVICE_NAME;
ConfigParam *param;
- int enabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
- if (enabled != -1 && enabled != 1)
+ zeroconfEnabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
+ if (enabled == -1)
+ zeroconfEnabled = DEFAULT_ZEROCONF_ENABLED;
+ else if (enabled < 0)
+ exit(EXIT_FAILURE);
+
+ if (!zeroconfEnabled)
return;
param = getConfigParam(CONF_ZEROCONF_NAME);
@@ -570,9 +579,7 @@ void initZeroconf(void)
void finishZeroconf(void)
{
- int enabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
-
- if (enabled != -1 && enabled != 1)
+ if (!zeroconfEnabled)
return;
#ifdef HAVE_AVAHI