-// differs between different systems
+// differs between different systems and for the systems which use opaque
+// structs for it (at least AIX and OpenBSD) it must be zero-filled before
+// being passed to the system functions
-#ifdef HAVE_FUNC_GETSERVBYNAME_R_3
- typedef servent_data wxGetservBuf;
+#ifdef HAVE_FUNC_GETSERVBYNAME_R_4
+ struct wxGetservBuf : servent_data
+ {
+ wxGethostBuf()
+ {
+ memset(this, 0, sizeof(servent_data));
+ }
+ };
#define wxLOCK_GETBY_MUTEX(name)
#else // may need mutexes to protect getxxxbyxxx() calls
#if defined(HAVE_GETHOSTBYNAME) || \
#define wxLOCK_GETBY_MUTEX(name)
#else // may need mutexes to protect getxxxbyxxx() calls
#if defined(HAVE_GETHOSTBYNAME) || \
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_5)
se = getservbyname_r(port, protocol, serv, buffer, size);
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_4)
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_5)
se = getservbyname_r(port, protocol, serv, buffer, size);
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_4)
- se = getservbyname_r(port, protocol, serv, &buffer);
+ if ( getservbyname_r(port, protocol, serv, &buffer) != 0 )
+ return NULL;