Re: Getting it to all work on HPUX
[email protected] (Christos Zoulas)
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Organization | Astron Software |
| Message-ID | <[email protected]> |
On Feb 6, 2:53pm, [email protected] (Frediano Ziglio) wrote: -- Subject: Re: [freetds] Getting it to all work on HPUX | 2009/2/4 Michael Warchut <[email protected]>: | > James | > | > I did what you suggested.. Adding sleep didn't help the situation but | > commenting out the getsockopt check did. I can now connect successfully. | > It's kind of hack so I would love to figure out the root cause and fix it | > but at this point I will take what I can get.. :) | > | > | | 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 . christos