Re: Getting it to all work on HPUX

"Michael Warchut" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <011001c98870$f3239580$d96ac080$@com>
Thanks.. I have another box to build this weekend so I will give this a try
and see what it yields me.

Michael


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Frediano Ziglio
Sent: Friday, February 06, 2009 5:53 AM
To: FreeTDS Development Group
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.

freddy77
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
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.