- inet_ntop(sin->sin_family, &sin->sin_addr, where, sizeof(where));
- catta_log_debug("sendmsg() to %s failed: %s", where, strerror(errno));
+ if(sa->sa_family == AF_INET)
+ inet_ntop(sa->sa_family, &((struct sockaddr_in *)sa)->sin_addr, where, sizeof(where));
+ else
+ inet_ntop(sa->sa_family, &((struct sockaddr_in6 *)sa)->sin6_addr, where, sizeof(where));
+ catta_log_debug("sendmsg() to %s failed: %s", where, errnostrsocket());