Skip to Content.
Sympa Menu

freetds - Re: [freetds] Data conversion limit for strings

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Data conversion limit for strings
  • Date: Mon, 26 Jan 2004 10:36:26 -0500

On Mon, 26 Jan 2004, "ZIGLIO, Frediano, VF-IT"
<Frediano.Ziglio AT vodafone.com> wrote:
>
> Patch works however it's the correct way to fix problem? We ignore all
> errors replacing with logs...

The patch doesn't completely ignore all errors. Errors are emitted by
tds_iconv(), and can be trapped by the error handler.

Perhaps you're right, though. tds_put_string() simply returns the count
of bytes sent. It used to return -1 if it encountered any problem from
tds_iconv(). Perhaps it should return the count of input bytes converted:
"len" (or strlen()) for success, and some lesser number for failure. That
would give the caller more information.

> Perhaps it should be better to return 0
> from tds_iconv on EINVAL and suppress->einval ?? Or just continue (in
> write.c) if we get EINVAL and there is still data to write (len > 0) ??

If tds_iconv() sets errno to EINVAL on any chunk except the last one, we
do and should ignore it. The input buffer pointer & count will be set to
the beginning of the incomplete sequence; we just flush the output and
call tds_iconv() again. (In fact, we work too hard, estimating
inbytesleft. We should just suppress E2BIG and let tds_iconv() convert as
much of the input as it has room for.)

> IMHO this patch should be put on 0.62 too...

Will do.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page