[freetds] dblib problems

Frediano Ziglio freddyz77 at tin.it
Tue Jul 15 09:05:41 EDT 2003


...
> 
> 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




More information about the FreeTDS mailing list