summaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-12-05 16:30:52 +0000
committerNick Mathewson <nickm@torproject.org>2007-12-05 16:30:52 +0000
commitf948caad7b5bd4760fe986392e0a500721729a2c (patch)
tree04d5529a1ae5a3dbe4eda172fb61e7bd1e66ed9d /src/common/compat.h
parent29045d21b35bdb6440fa0861bd74f165f136c8e7 (diff)
downloadtor-f948caad7b5bd4760fe986392e0a500721729a2c.tar.gz
tor-f948caad7b5bd4760fe986392e0a500721729a2c.zip
r15161@tombo: nickm | 2007-12-05 11:30:37 -0500
Fix bug reported by Steve Murphy on or-talk: detect the s6_addr32 and s6_addr16 fields via autoconf. svn:r12679
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index af8b6ae143..e775884430 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -302,15 +302,17 @@ struct in6_addr
typedef uint16_t sa_family_t;
#endif
-#ifndef _MSC_VER
-/* Apparently, MSVC doesn't define s6_addr16 or s6_addr32. How dumb. */
-/* XXXX020 detect with autoconf. */
-#define S6_ADDR16(x) ((uint16_t*)(x).s6_addr16)
+/* Apparently, MS and Solaris don't define s6_addr16 or s6_addr32. */
+#ifdef HAVE_STRUCT_IN6_ADDR_S6_ADDR32
#define S6_ADDR32(x) ((uint32_t*)(x).s6_addr32)
#else
-#define S6_ADDR16(x) ((uint16_t*)((char*)&(x).s6_addr))
#define S6_ADDR32(x) ((uint32_t*)((char*)&(x).s6_addr))
#endif
+#ifdef HAVE_STRUCT_IN6_ADDR_S6_ADDR16
+#define S6_ADDR16(x) ((uint16_t*)(x).s6_addr16)
+#else
+#define S6_ADDR16(x) ((uint16_t*)((char*)&(x).s6_addr))
+#endif
/* XXXX020 detect sockaddr_in6 correctly on ms_windows; this is also a hack. */
#if !defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(MS_WINDOWS)