6 argument gethostbyname_r test is too generic
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
I'm upgrading to gsoap 2.8.82 on an OmniOS platform (illumos/opensolaris derivative) and seeing:
stdsoap2_ck_cpp.cpp: In function 'int tcp_gethostbyname(soap*, const char*, hostent*, in_addr*)':
stdsoap2_ck_cpp.cpp:5106:62: error: cannot convert 'hostent**' to 'int*'
while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &soap->errnum)) < 0)
^~~~~~~~
In file included from stdsoap2.h:920,
from stdsoap2_ck_cpp.cpp:65:
/usr/include/netdb.h:239:53: note: initializing argument 5 of 'hostent* gethostbyname_r(const char*, hostent*, char*, int, int*)'
(const char *, struct hostent *, char *, int, int *h_errnop);
~~~~~^~~~~~~~
This is because the new check for the 6-argument gethostbyname_r variant is catching any system which has gethostbyname_r and uses the GNU compiler.
&& (defined(FREEBSD) || defined(FreeBSD)))
the above matches if
(defined(HAVE_GETHOSTBYNAME_R) && (defined(GNU) || defined(GNUC)))
does.
The following change should fix this, which is part of gSOAP 2.8.83:
~~~
if defined(GLIBC) && (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && defined(HAVE_GETHOSTBYNAME_R)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(ANDROID) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(FreeBSD)))
while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &soap->errnum)) < 0)
~~~