If user (in this case me :-), does not specify all required parameters
to FreeTDS connection (such as server), we may segfault. We should
handle this more gracefully, I think.

Also, I don't think we should be printing anything out to stderr
directly from the driver.

Patch attached.

PS. There is another fprintf() to stderr in the driver, which I think
should also be removed. It's in the compilation of that regex. If we
must have the regex in order to function, then we should return NULL on
open_ex() or something and set the error accordingly.

-- 
Bojan
Index: dbd/apr_dbd_freetds.c
===================================================================
--- dbd/apr_dbd_freetds.c	(revision 743241)
+++ dbd/apr_dbd_freetds.c	(working copy)
@@ -606,9 +606,7 @@
 
     process = dbopen(login, server);
 
-    fprintf(stderr, "databaseName [%s]\n", databaseName);
-
-    if (databaseName != NULL)
+    if (process != NULL && databaseName != NULL)
     {
         dbuse(process, databaseName);
     }

Reply via email to