]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Kludgey endianness fix (for printing only) to stop fdleak_ipv4 failing on
authorJulian Seward <jseward@acm.org>
Thu, 17 Nov 2005 11:45:28 +0000 (11:45 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 17 Nov 2005 11:45:28 +0000 (11:45 +0000)
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

coregrind/m_syswrap/syswrap-generic.c

index 6bce26df33581e1ddf00b1e2eeb095178ce851c5..351f90b99c843cd3c8aee56e15f34d7ed6cc02d9 100644 (file)
@@ -537,7 +537,12 @@ Char *inet2name(struct vki_sockaddr_in *sa, UInt len, Char *name)
       VG_(sprintf)(name, "<unknown>");
    } 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, "<unbound>");
       } else {