Date: Mon, 7 Mar 2011 10:39:26 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219371 - head/sbin/hastd Message-ID: <201103071039.p27AdQMO032267@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103071039.p27AdQMO032267>