commit 1d7beea2ab513c31845abb61d79fb5960b038e4b Merge: 2a6d12c 718252b Author: Nick Mathewson nickm@torproject.org Date: Wed Jul 20 13:17:59 2011 -0400
Merge remote-tracking branch 'origin/maint-0.2.2'
changes/fmt_addr | 4 ++++ src/common/address.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --cc src/common/address.c index d0c2d5e,7fc7301..26a59e9 --- a/src/common/address.c +++ b/src/common/address.c @@@ -958,23 -958,12 +958,25 @@@ fmt_addr(const tor_addr_t *addr { static char buf[TOR_ADDR_BUF_LEN]; if (!addr) return "<null>"; - tor_addr_to_str(buf, addr, sizeof(buf), 0); - return buf; + if (tor_addr_to_str(buf, addr, sizeof(buf), 0)) + return buf; + else + return "???"; }
+/** Like fmt_addr(), but takes <b>addr</b> as a host-order IPv4 + * addresses. Also not thread-safe, also clobbers its return buffer on + * repeated calls. */ +const char * +fmt_addr32(uint32_t addr) +{ + static char buf[INET_NTOA_BUF_LEN]; + struct in_addr in; + in.s_addr = htonl(addr); + tor_inet_ntoa(&in, buf, sizeof(buf)); + return buf; +} + /** Convert the string in <b>src</b> to a tor_addr_t <b>addr</b>. The string * may be an IPv4 address, an IPv6 address, or an IPv6 address surrounded by * square brackets.
tor-commits@lists.torproject.org