interface: print whole debug message at once

Using SECURE once without a \n, and again with one, results in a timestamp
mid-line.  Let's not do that.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6827 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
J. Alexander Treuman 2007-08-27 21:10:44 +00:00
parent 8d89add8e7
commit 752bf24b74

View File

@ -254,6 +254,7 @@ static void closeInterface(Interface * interface)
void openAInterface(int fd, struct sockaddr *addr) void openAInterface(int fd, struct sockaddr *addr)
{ {
char *hostname;
int i; int i;
for (i = 0; i < interface_max_connections for (i = 0; i < interface_max_connections
@ -263,16 +264,15 @@ void openAInterface(int fd, struct sockaddr *addr)
ERROR("Max Connections Reached!\n"); ERROR("Max Connections Reached!\n");
xclose(fd); xclose(fd);
} else { } else {
SECURE("interface %i: opened from ", i);
switch (addr->sa_family) { switch (addr->sa_family) {
case AF_INET: case AF_INET:
{ {
char *host = inet_ntoa(((struct sockaddr_in *) char *host = inet_ntoa(((struct sockaddr_in *)
addr)->sin_addr); addr)->sin_addr);
if (host) { if (host) {
SECURE("%s\n", host); hostname = host;
} else { } else {
SECURE("error getting ipv4 address\n"); hostname = "error getting ipv4 address";
} }
} }
break; break;
@ -285,19 +285,20 @@ void openAInterface(int fd, struct sockaddr *addr)
&(((struct sockaddr_in6 *)addr)-> &(((struct sockaddr_in6 *)addr)->
sin6_addr), host, sin6_addr), host,
INET6_ADDRSTRLEN)) { INET6_ADDRSTRLEN)) {
SECURE("%s\n", host); hostname = host;
} else { } else {
SECURE("error getting ipv6 address\n"); hostname = "error getting ipv6 address";
} }
} }
break; break;
#endif #endif
case AF_UNIX: case AF_UNIX:
SECURE("local connection\n"); hostname = "local connection";
break; break;
default: default:
SECURE("unknown\n"); hostname = "unknown";
} }
SECURE("interface %i: opened from %s\n", i, hostname);
openInterface(&(interfaces[i]), fd); openInterface(&(interfaces[i]), fd);
} }
} }