aboutsummaryrefslogtreecommitdiffstats
path: root/src/listen.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-10-28 05:14:55 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-10-28 05:14:55 +0000
commit58dbe4bb5d974c34335d6906a9ce930f07cd1db4 (patch)
tree9a6aee08b21100cb74e809f0620d81466f6067df /src/listen.c
parent8f40569aeeafe4a36e3d719c1df97de42606ea76 (diff)
downloadmpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.tar.gz
mpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.tar.xz
mpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.zip
merge shank-rewrite-config changes
git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/listen.c')
-rw-r--r--src/listen.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/listen.c b/src/listen.c
index 49ff4c33e..065e1ccc6 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -44,6 +44,7 @@
int listenSocket;
int establish(unsigned short port) {
+ ConfigParam * param;
int allowReuse = ALLOW_REUSE;
int sock;
struct sockaddr * addrp;
@@ -60,8 +61,10 @@ int establish(unsigned short port) {
memset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_port = htons(port);
sin.sin_family = AF_INET;
+
+ param = getConfigParam(CONF_BIND_TO_ADDRESS);
- if(strcmp((getConf())[CONF_BIND_TO_ADDRESS],"any")==0) {
+ if(!param || 0==strcmp(param->value, "any")==0) {
#ifdef HAVE_IPV6
if(ipv6Supported()) {
sin6.sin6_addr = in6addr_any;
@@ -78,9 +81,9 @@ int establish(unsigned short port) {
}
else {
struct hostent * he;
- if(!(he = gethostbyname((getConf())[CONF_BIND_TO_ADDRESS]))) {
- ERROR("can't lookup host \"%s\"\n",
- (getConf())[CONF_BIND_TO_ADDRESS]);
+ if(!(he = gethostbyname(param->value))) {
+ ERROR("can't lookup host \"%s\" at line %i\n",
+ param->value, param->line);
exit(EXIT_FAILURE);
}
switch(he->h_addrtype) {
@@ -88,8 +91,8 @@ int establish(unsigned short port) {
case AF_INET6:
if(!ipv6Supported()) {
ERROR("no IPv6 support, but a IPv6 address "
- "found for \"%s\"\n",
- (getConf())[CONF_BIND_TO_ADDRESS]);
+ "found for \"%s\" at line %i\n",
+ param->value, param->line);
exit(EXIT_FAILURE);
}
bcopy((char *)he->h_addr,(char *)
@@ -105,8 +108,9 @@ int establish(unsigned short port) {
addrlen = sizeof(struct sockaddr_in);
break;
default:
- ERROR("address type for \"%s\" is not IPv4 or IPv6\n",
- (getConf())[CONF_BIND_TO_ADDRESS]);
+ ERROR("address type for \"%s\" is not IPv4 or IPv6 "
+ "at line %i\n",
+ param->value, param->line);
exit(EXIT_FAILURE);
}
}