Skip to Content.
Sympa Menu

freetds - Re: [freetds] Patch to fix nasty HP-UX problem (was TSQL error - connect error: Not owner)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Patch to fix nasty HP-UX problem (was TSQL error - connect error: Not owner)
  • Date: Tue, 12 Feb 2008 12:01:35 -0500

ZIGLIO, Frediano, VF-IT wrote:
> # if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
> # undef _XOPEN_SOURCE_EXTENDED

I do not like '#if OS' tests; I prefer '#if FEATURE'. What feature are
you testing?

I think the test is:

For a 64-bit machine, make sure the signature is

extern int getsockopt __((int, int, int, void *, socklen_t *));

and not

extern int getsockopt __((int, int, int, void *, int *));

Is that correct?

We can add a config.ac test that compiles getsockopt passing socklen_t* as
the 4th argument. If that works on a 64-bit machine, ok, else it can
undefine _XOPEN_SOURCE_EXTENDED and try again. Outcomes:

1. Works first time, OK out of the box.
2. Works if _XOPEN_SOURCE_EXTENDED is undefined.
(#define UNDEF_XOPEN_SOURCE_EXTENDED_4_GETSOCKOPT 1)
3. Does not work, #error.

Then your code becomes:

#if HAVE_SYS_SOCKET_H
# if UNDEF_XOPEN_SOURCE_EXTENDED_4_GETSOCKOPT
# define tds_XOPEN_SOURCE_EXTENDED \
_XOPEN_SOURCE_EXTENDED
# undef _XOPEN_SOURCE_EXTENDED
# include <sys/socket.h>
# define _XOPEN_SOURCE_EXTENDED \
tds_XOPEN_SOURCE_EXTENDED
# undef tds_XOPEN_SOURCE_EXTENDED
# else
# include <sys/socket.h>
# endif
#endif /* HAVE_SYS_SOCKET_H */

That logic preserves the value of _XOPEN_SOURCE_EXTENDED, in case it
matters.

How does that sound?

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page