From: Paul Cochrane <paul.m.cochrane@tuht.scot.nhs.uk>
To: pgsql-odbc@postgresql.org
Subject: Re: Bug in convert.c copy_and_convert_field
Date: Fri, 11 Feb 2005 18:06:27 +0000
Message-ID: <420CF423.1090403@tuht.scot.nhs.uk> (raw)
In-Reply-To: <420CEB3C.4050003@tuht.scot.nhs.uk>
References: <420CEB3C.4050003@tuht.scot.nhs.uk>
Paul Cochrane wrote:
> Hi again list.
>
> I think I've encountered a bug in the file convert.c -
> copy_and_convert_field procedure. Unfortunately my C is a little out
> of practise not having done it for 10 years or so. Can anyone help? I
> think I've traced the error to the default part of the switch around
> line 850 (that where the dodgy lines are being placed in the mylog
> file so it's somewhere before that). Below is a snippet of the mylog
> showing the problem. The lines where it is saying DEFAULT: & the ptr
> part of the string. In some cases this is correct but in others there
> are lots of extra / strange characters. The len field always seems to
> be correct however.
>
> The log file ends with a single ' which may explain the error I get on
> the server (1) could not receive data from client: Connection reset by
> peer and (2) unexpected EOF on client connection
>
I've found a quick fix to this problem. I've simply added a line:
strncpy(ptr+len, "\0", 1);
just before the mylog line on line 850 of convert.c. I believe this
simply ensures that there is a NULL at the end of the string stored in
ptr. There may be a more elegant way to do this but it seems to work.
Now onto the next fault cause it fails again shortly after this.
Bugger! :-(
Paul
--
Paul Cochrane (paul.m.cochrane@tuht.scot.nhs.uk)
+--------------------------------------------------------
| Tayside Orthopaedic & Rehabilitation Technology Centre
| Ninewells Hospital & Medical School
| Dundee, Scotland, UK.
| DD1 9SY
| Phone: Internal: 36284
| External: +44 (1382) 496284
| Fax: +44 (1382) 496322
+--------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: paul.m.cochrane@tuht.scot.nhs.uk
Subject: Re: Bug in convert.c copy_and_convert_field
In-Reply-To: <420CF423.1090403@tuht.scot.nhs.uk>
References: <420CEB3C.4050003@tuht.scot.nhs.uk> <420CF423.1090403@tuht.scot.nhs.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox