aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-02-25 19:13:10 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-02-25 19:13:10 +0000
commite1c839cd5679f9b60f6b5e2bfd3a341b64463456 (patch)
treef7876c1600e29d38f3a574333e482e4651a3d382 /src/interface.c
parent483d8873bd851abb0db066323e0512e1a22dc840 (diff)
downloadmpd-e1c839cd5679f9b60f6b5e2bfd3a341b64463456.tar.gz
mpd-e1c839cd5679f9b60f6b5e2bfd3a341b64463456.tar.xz
mpd-e1c839cd5679f9b60f6b5e2bfd3a341b64463456.zip
cleanup logging, need to be careful with SECURE and DEBUG
git-svn-id: https://svn.musicpd.org/mpd/trunk@58 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/interface.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/interface.c b/src/interface.c
index 66c912f45..b1f016bc3 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -156,18 +156,32 @@ void openAInterface(int fd, struct sockaddr * addr) {
SECURE("interface %i: opened from ",i);
switch(addr->sa_family) {
case AF_INET:
- SECURE("%s\n",inet_ntoa(
+ {
+ char * host = inet_ntoa(
((struct sockaddr_in *)addr)->
- sin_addr));
+ sin_addr);
+ if(host) {
+ SECURE("%s\n",host);
+ }
+ else {
+ SECURE("error getting ipv4 address\n");
+ }
+ }
break;
#ifdef HAVE_IPV6
case AF_INET6:
{
char host[INET6_ADDRSTRLEN+1];
memset(host,0,INET6_ADDRSTRLEN+1);
- SECURE("%s\n",inet_ntop(AF_INET6,(void *)
+ if(inet_ntop(AF_INET6,(void *)
&(((struct sockaddr_in6 *)addr)->
- sin6_addr),host,INET6_ADDRSTRLEN));
+ sin6_addr),host,INET6_ADDRSTRLEN))
+ {
+ SECURE("%s\n",host);
+ }
+ else {
+ SECURE("error getting ipv6 address\n");
+ }
}
break;
#endif