Skip to Content.
Sympa Menu

freetds - RE: [freetds] dblib problems

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] dblib problems
  • Date: Tue, 15 Jul 2003 08:05:41 -0000

...
>
> I think the problem lies in Microsoft's semantics for connect(2). Our code
> expects BSD semantics:
>
> retval = connect(tds->s, (struct sockaddr *) &sin, sizeof(sin));
> if (retval < 0 && errno == EINPROGRESS)
> retval = 0;
>
> Microsoft doesn't return -1 and set errno. They return SOCKET_ERROR (-1),
> and say WSAGetLastError() will return WSAEWOULDBLOCK. They don't touch
> errno.
>
> Here's a quick hack:
>
> retval = connect(tds->s, (struct sockaddr *) &sin, sizeof(sin));
> # if WIN32
> if (retval < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
> # else
> if (retval < 0 && errno == EINPROGRESS)
> # endif
> retval = 0;
>
> Does that make any difference?
>

I put a fix on CVS (seconds ago) using sock_errno instead of errno (just
a macro that fix this problem in write.c)

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page