--- libaitio/src/Attic/tools.c 2012/05/14 15:17:26 1.11.2.2 +++ libaitio/src/Attic/tools.c 2012/05/15 23:15:07 1.12.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tools.c,v 1.11.2.2 2012/05/14 15:17:26 misho Exp $ +* $Id: tools.c,v 1.12.2.2 2012/05/15 23:15:07 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -420,8 +420,6 @@ io_n2port(io_sockaddr_t * __restrict addr) case AF_INET6: return ntohs(addr->sin6.sin6_port); default: - io_SetErr(ESOCKTNOSUPPORT, "Unsuported address family %d", - addr->sa.sa_family); break; } @@ -444,6 +442,7 @@ io_n2addr(io_sockaddr_t * __restrict addr, ait_val_t * if (!addr || !val) return ret; + AIT_INIT_VAL(val); switch (addr->sa.sa_family) { case AF_INET: if (!inet_ntop(AF_INET, &addr->sin.sin_addr, str, INET_ADDRSTRLEN)) { @@ -459,6 +458,9 @@ io_n2addr(io_sockaddr_t * __restrict addr, ait_val_t * } else ret = str; break; + case AF_LOCAL: + ret = addr->sun.sun_path; + break; default: io_SetErr(EPROTONOSUPPORT, "Unsuported address family %d", addr->sa.sa_family); @@ -484,6 +486,8 @@ io_gethostbyname(const char *psHost, u_short port, io_ if (!psHost || !addr) return NULL; + else + memset(addr, 0, sizeof(io_sockaddr_t)); if (*psHost != '/') { /* resolver */ @@ -499,7 +503,6 @@ io_gethostbyname(const char *psHost, u_short port, io_ } else addr->sa.sa_family = AF_LOCAL; - memset(addr, 0, sizeof(io_sockaddr_t)); switch (addr->sa.sa_family) { case AF_INET: addr->sin.sin_len = sizeof(struct sockaddr_in);