Skip to Content.
Sympa Menu

freetds - Re: [freetds] Bug in dblib CHECK_CONN macro?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Bug in dblib CHECK_CONN macro?
  • Date: Sat, 19 Dec 2015 10:01:16 +0000

2015-12-18 20:06 GMT+00:00 Joshua Lang <joshua.h.lang AT gmail.com>:
> It seems that once the TDS socket on a dblib connection becomes invalid,
> the error handling no long er references the connection, even though it
> seems as though it should? Perhaps I'm missing something? This is causing
> subsequent uses of the DBPROCESS pointer to fail (as they should), but the
> resulting error is not correctly associated with the DBPROCESS.
>
> See below for a patch. Note that dbproc is passed instead of NULL to
> dbperror.
>
> diff --git a/include/dblib.h b/include/dblib.h
> index e03ccaa..019c99d 100644
> --- a/include/dblib.h
> +++ b/include/dblib.h
> @@ -199,7 +199,7 @@ extern EHANDLEFUNC _dblib_err_handler;
> #define DBPERROR_RETURN(x, msg) if (x) { dbperror(dbproc, (msg),
> 0); return FAIL; }
> #define DBPERROR_RETURN3(x, msg, a, b, c) if (x) { dbperror(dbproc,
> (msg), 0, a, b, c); return FAIL; }
> #define CHECK_CONN(ret) do { CHECK_PARAMETER(dbproc, SYBENULL, (ret)); \
> - if (IS_TDSDEAD(dbproc->tds_socket)) { dbperror(NULL, SYBEDDNE, 0);
> return (ret); } } while(0)
> + if (IS_TDSDEAD(dbproc->tds_socket)) { dbperror(dbproc, SYBEDDNE,
> 0); return (ret); } } while(0)
>
>
> #ifdef __cplusplus


Well spot!

https://github.com/FreeTDS/freetds/commit/420141cc10a8f0110e1c6773d3487c4b085af9a2

(also in 0.95)

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page