httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r413015 - /httpd/httpd/trunk/modules/database/mod_dbd.c
Date Fri, 09 Jun 2006 11:15:41 GMT
Author: niq
Date: Fri Jun  9 04:15:41 2006
New Revision: 413015

URL: http://svn.apache.org/viewvc?rev=413015&view=rev
Log:
PR#39761
Make the error message more meaningful when DBD is configured
without a driver.

Modified:
    httpd/httpd/trunk/modules/database/mod_dbd.c

Modified: httpd/httpd/trunk/modules/database/mod_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/database/mod_dbd.c?rev=413015&r1=413014&r2=413015&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/database/mod_dbd.c (original)
+++ httpd/httpd/trunk/modules/database/mod_dbd.c Fri Jun  9 04:15:41 2006
@@ -67,6 +67,8 @@
                cmd_min, cmd_keep, cmd_max, cmd_exp
 } cmd_parts;
 
+/* a default DBDriver value that'll generate meaningful error messages */
+static const char *const no_dbdriver = "[DBDriver unset]";
 
 #define ISINT(val) \
         for (p = val; *p; ++p)        \
@@ -182,7 +184,7 @@
     svr_cfg *base = (svr_cfg*) BASE;
     svr_cfg *add = (svr_cfg*) ADD;
     svr_cfg *cfg = apr_pcalloc(pool, sizeof(svr_cfg));
-    cfg->name = strcmp(add->name, "") ? add->name : base->name;
+    cfg->name = (add->name != no_dbdriver) ? add->name : base->name;
     cfg->params = strcmp(add->params, "") ? add->params : base->params;
     cfg->persist = (add->persist == -1) ? base->persist : add->persist;
 #if APR_HAS_THREADS
@@ -205,7 +207,8 @@
 static void *dbd_cfg(apr_pool_t *p, server_rec *x)
 {
     svr_cfg *svr = (svr_cfg*) apr_pcalloc(p, sizeof(svr_cfg));
-    svr->name = svr->params = ""; /* don't risk segfault on misconfiguration */
+    svr->params = ""; /* don't risk segfault on misconfiguration */
+    svr->name = no_dbdriver; /* to generate meaningful error messages */
     svr->persist = -1;
 #if APR_HAS_THREADS
     svr->nmin = DEFAULT_NMIN;



Mime
View raw message