Skip to Content.
Sympa Menu

freetds - [freetds] Bug in dblib CHECK_CONN macro?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Joshua Lang <joshua.h.lang AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Bug in dblib CHECK_CONN macro?
  • Date: Fri, 18 Dec 2015 12:06:49 -0800

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




Archive powered by MHonArc 2.6.24.

Top of Page