Menu

#1246 6 argument gethostbyname_r test is too generic

v1.0 (example)
closed-fixed
None
5
2019-04-18
2019-04-16
Andy
No

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.


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(GNU) || defined(GNUC))) || (defined(HAVE_GETHOSTBYNAME_R)

&& (defined(FREEBSD) || defined(FreeBSD)))


the above matches if


(defined(HAVE_GETHOSTBYNAME_R) && (defined(GNU) || defined(GNUC)))


does.

Discussion

  • Robert van Engelen

    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)
    ~~~

     
  • Robert van Engelen

    • status: open --> pending-fixed
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB