error message on bigendian platforms
Mark J. Lilback
mark at lilback.com
Wed Jun 20 18:50:06 EDT 2001
Is anyone on a big endian platform getting error messages when you
issue a bad query?
Using TDS 4.2 talking to MS SQL Server 7 SP3 from Mac OS 9.1, I'm
sending a bad query. The TDS packet that is returned is giving a
value of 0xAA000000 for the tds->msg_info->msg_number, but this value
is retrieved by calling tds_get_int. There are no big endian checks
in there anywhere.
dblib_handle_err_message is being called via g_tds_err_handler to
handle the error, but it checks to see if
(tds->msg_info->msg_number >0), which in this case it isn't, since
there was no swap of bytes.
Now my debugger doesn't show the value of tds->msg_info->msg_number
getting changed by the call to tds_get_int(), but I think this is
because tds->msg_info->msg_number is defined as a TDS_SMALLINT, so
the top 2 bytes are being discarded when the value is cast.
Looking through read.c, there don't seem to by any kinds of checks
for endianness -- is byte-swapping ever being done at the tds layer?
It seems in this case that it does, and I'd imagine there are more
places like this.
I'm a little behind on what is in the CVS repository, but this
definitely needs to get fixed for the next release.
--
__________________________________________________________________________
"The best assumption to have
Mark J. Lilback is that any commonly held
<mark at lilback.com> belief is wrong." -- Ken Olsen,
http://www.lilback.com/ founder, Digital Equip. Corp.
More information about the FreeTDS
mailing list