Skip to Content.
Sympa Menu

freetds - Re: [freetds] Getting it to all work on HPUX

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Getting it to all work on HPUX
  • Date: Fri, 6 Feb 2009 17:32:53 +0100

....
> |
> | 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




Archive powered by MHonArc 2.6.24.

Top of Page