Bug in dblib CHECK_CONN macro?

Joshua Lang <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAFTwDJSp9pNz-H=P3pg7EO_0kZTx+5QY5yo0JfCLnaSLFSGvWg@mail.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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.