Re: Getting it to all work on HPUX

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
....
> |
> | Please try replacing
> |
> |
> |       len = 0;
> |       if (getsockopt(tds->s, SOL_SOCKET, SO_ERROR, (char *) &len, &optlen) != 0) {
> |               tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) failed: %s\n",
> | strerror(sock_errno));
> |               goto not_available;
> |       }
> |
> |
> | with
> |
> |
> |       len = 0;
> |       if (getsockopt(tds->s, SOL_SOCKET, SO_ERROR, (char *) &len, &optlen) != 0) {
> | #if defined(__hpux__) && SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
> |               int optlen = sizeof(len);
> |               len = 0;
> |                 if (errno != EINVAL || getsockopt(tds->s, SOL_SOCKET,
> | SO_ERROR, (char *) &len, (socklen_t *) &optlen) != 0) {
> |                       tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) failed: %s\n",
> | strerror(sock_errno));
> |                       goto not_available;
> |               }
> | #else
> |               tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) failed: %s\n",
> | strerror(sock_errno));
> |               goto not_available;
> | #endif
> |       }
> |
> |
> |
> | getsockopt definition in HP-UX is not that fine.... assuming different
> | size of last parameter is not that fine... and this change chaning
> | definitions or even linker options :(
> | This code try first with 8 byte socklen_t and than with 4 byte version.
>
> I think we should use an autoconf test to detect the presence of socklen_t
> instead of resorting to such ugliness .
>

We already test for socklen_t. The problem is that HP-UX use
socklen_t* for last getsockopt argument in some cases and int in some
others (giving different defines). socklen_t is always size_t on HP-UX
so it's 64bit on 64bit platform and 32bit on 32bit while int is always
32bit.

freddy77
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.