Paul,
On the default where if the prefix is not specified it needs to be
changed to look like this. Didn't feel like doing a diff. This is because
we need pople to be able to specify a prefix of "" your fix doesn't allow
for this I have changed my config.c function to look like such:
void GetDBParams(db_param_t * db_params)
{
field_t port_string;
field_t sock_string;
if (GetConfigValue("host", "DBMAIL", db_params->host) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("db", "DBMAIL", db_params->db) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("user", "DBMAIL", db_params->user) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("pass", "DBMAIL", db_params->pass) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("sqlport", "DBMAIL", port_string) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("sqlsocket", "DBMAIL", sock_string) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (GetConfigValue("table_prefix", "DBMAIL", db_params->pfx) < 0){
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
if (strlen(db_params->pfx) == 0)
strncpy(db_params->pfx, DEFAULT_DBPFX, FIELDSIZE);
}
/* check if port_string holds a value */
if (strlen(port_string) != 0) {
db_params->port =
(unsigned int) strtoul(port_string, NULL, 10);
if (errno == EINVAL || errno == ERANGE)
trace(TRACE_FATAL,
"%s,%s: wrong value for sqlport in "
"config file", __FILE__, __func__);
} else
db_params->port = 0;
/* same for sock_string */
if (strlen(sock_string) != 0)
strncpy(db_params->sock, sock_string, FIELDSIZE);
else
db_params->sock[0] = '\0';
}
notice the DEFAULT_DBPFX is withing the case check for the item in the
config file.
Thanks,
leif