Skip to Content.
Sympa Menu

freetds - Patch to fix PHP cancel problem with ASA-6

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <lbayuk AT mindspring.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Patch to fix PHP cancel problem with ASA-6
  • Date: Sun, 8 Sep 2002 21:39:23 -0400 (EDT)


Here is a patch to src/tds/read.c which fixes the error handling problem
I've been having with FreeTDS, PHP-4.2.3, and Sybase ASA-6, after PHP sends
a Cancel. (This requires the previous fix already applied by Brian to
tds_get_byte()).

I realize that messing with a critical function like tds_read_packet()
close to a release is unwise, but I've placed the patch inside an existing
error handling block to minimize potential harm. And I really, really need
this, or FreeTDS+PHP+ASA is not usable.

The patch does this: If reading the body of the packet didn't work (x<1),
but the header said there weren't any bytes in the body anyway, then return
0 instead of the error code -1. This lets tds_get_byte() read through the
body-less packet ASA sends after Cancel, read the Done packet it was meant
to see, and stay in sync with the server. I think this was the intended
behavior with recent patches to cancel processing, however they didn't work
because tds_read_packet still returned -1 when it got a packet with only a
header.

--- src/tds/read.c.bak 2002-09-08 20:16:58.000000000 -0400
+++ src/tds/read.c 2002-09-08 20:59:22.000000000 -0400
@@ -386,7 +386,7 @@
tds->in_len=0;
tds->in_pos=0;
tds->last_packet=1;
- return(-1);
+ return(len ? -1 : 0);
}

/* Set the last packet flag */




Archive powered by MHonArc 2.6.24.

Top of Page