Author: pjd Date: Mon Mar 7 10:39:26 2011 New Revision: 219371 URL: http://svn.freebsd.org/changeset/base/219371
Log: Use %S to print IP address and port number. MFC after: 2 weeks Modified: head/sbin/hastd/proto_tcp4.c Modified: head/sbin/hastd/proto_tcp4.c ============================================================================== --- head/sbin/hastd/proto_tcp4.c Mon Mar 7 10:38:18 2011 (r219370) +++ head/sbin/hastd/proto_tcp4.c Mon Mar 7 10:39:26 2011 (r219371) @@ -475,22 +475,6 @@ tcp4_descriptor(const void *ctx) return (tctx->tc_fd); } -static void -sin2str(struct sockaddr_in *sinp, char *addr, size_t size) -{ - in_addr_t ip; - unsigned int port; - - PJDLOG_ASSERT(addr != NULL); - PJDLOG_ASSERT(sinp->sin_family == AF_INET); - - ip = ntohl(sinp->sin_addr.s_addr); - port = ntohs(sinp->sin_port); - PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%u.%u.%u.%u:%u", - ((ip >> 24) & 0xff), ((ip >> 16) & 0xff), ((ip >> 8) & 0xff), - (ip & 0xff), port) < (ssize_t)size); -} - static bool tcp4_address_match(const void *ctx, const char *addr) { @@ -529,7 +513,7 @@ tcp4_local_address(const void *ctx, char PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size); return; } - sin2str(&sin, addr, size); + PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size); } static void @@ -547,7 +531,7 @@ tcp4_remote_address(const void *ctx, cha PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size); return; } - sin2str(&sin, addr, size); + PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size); } static void _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"