Skip to Content.
Sympa Menu

freetds - Re: [PATCH] Solaris/Intel client, Sybase server: Unknown marker: 105!!

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Steve Willer <willer AT novator.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: [PATCH] Solaris/Intel client, Sybase server: Unknown marker: 105!!
  • Date: Thu, 23 Aug 2001 11:22:30 -0400 (EDT)



On Wed, 22 Aug 2001, Steve Willer wrote:

>
> On Wed, 22 Aug 2001, Craig Jackson wrote:
>
> > > while (got < buflen) {
> > > got += READ(tds->s, buf + got, buflen - got);
> > > }
> >
> > This look like it could go into an infinite loop if READ returned 0 (EOF).
> > Is this checked for in the definition of READ?
>
> Good point. No, READ is just a macro wrapping around a simple read() call
> in Unix and recv() in Windows I think.
>
> I guess you need it a bit different:
>
> while (got < buflen) {
> int thisgot;
> thisgot = READ(tds->s, buf + got, buflen - got);
> if (!thisgot) break;
> got += thisgot;
> }
>
> hope I got the C right; I'm more of a Perl hacker nowadays.

Craig Jackson pointed out to me another bug: it wasn't detecting
error returns from read().

while (got < buflen) {
int thisgot;
thisgot = READ(tds->s, buf + got, buflen - got);
if (thisgot <= 0) break;
got += thisgot;
}






Archive powered by MHonArc 2.6.24.

Top of Page