From: Julian Seward Date: Thu, 17 Nov 2005 11:45:28 +0000 (+0000) Subject: Kludgey endianness fix (for printing only) to stop fdleak_ipv4 failing on X-Git-Tag: svn/VALGRIND_3_1_0~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c01a097e5b98f73222a58d166eb1d5583e21190b;p=thirdparty%2Fvalgrind.git Kludgey endianness fix (for printing only) to stop fdleak_ipv4 failing on ppc32. I'm sure there's a Right Way to fix it, and this isn't it. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5161 --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 6bce26df33..351f90b99c 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -537,7 +537,12 @@ Char *inet2name(struct vki_sockaddr_in *sa, UInt len, Char *name) VG_(sprintf)(name, ""); } else { UInt addr = sa->sin_addr.s_addr; - +# if defined(VG_BIGENDIAN) + /* This is a hack. I don't know enough to navigate my way through the + ntohl/ntonl maze. JRS 17 Nov 05. */ + addr = (((addr >> 24) & 0xFF) << 0) | (((addr >> 16) & 0xFF) << 8) + | (((addr >> 8) & 0xFF) << 16) | (((addr >> 0) & 0xFF) << 24); +# endif if (addr == 0) { VG_(sprintf)(name, ""); } else {