Skip to Content.
Sympa Menu

freetds - Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...
  • Date: Tue, 28 Nov 2006 09:01:32 -0500

On Nov 28, 8:10am, Glenn AT addsys.com ("Glenn, Chris") wrote:
-- Subject: Re: [freetds] Issue connecting to SQL Server from Linux Host with

| Just last night I was reviewing our networking code in conjunction with
| reading Steven's book, and it so happens I was looking at that very
| function.
|
| EINVAL is not a nice error code; it says we're not supplying a good
| value for some element of the sockaddr_in structure. NetBSD's manpage
| doesn't even mention it at as valid errno value for connect(2).
|
| The code itself looks OK, and comparing it to revision 1.14 (Tue Feb 22
| 16:04:36 2005), most of the changes are to the logging code and adding
| support for DOS32. That makes me wonder if it's a matter of configure
| perhaps misdetecting your system somehow. I think it was around that
| time that we upgraded the toolset that generates the configure script.
|
| I added yet more logging code, cf. patch below. With it, your log file
| should now dump the sockaddr_in structure. You can verify that, say,
| sin_family really is AF_INET according to your system's header files.
|
| I'm not sure we should leave this code in; it won't compile under Win32,
| for instance. But it will be in the next snapshot, and maybe it will
| help solve your problem.
|
| --jkl

The code is broken (if I am looking at the right version). All the fields
of sockaddr_in are required to be initialized to 0. Try adding a:

(void)memset(&sin, 0, sizeof(sin));

at the beginning of the function.

christos




Archive powered by MHonArc 2.6.24.

Top of Page