fix errors when using a null default in conf_get_string

This commit is contained in:
Ron Pedde 2006-02-27 23:39:11 +00:00
parent d3fc9de354
commit e5dd11b090
3 changed files with 7 additions and 1 deletions

View File

@ -395,6 +395,11 @@ int conf_get_string(char *section, char *key, char *dflt, char *out, int *size)
result = pitem->value.as_string;
}
if(!result) {
_conf_unlock();
return CONF_E_NOTFOUND;
}
len = (int) strlen(result) + 1;
if(len <= *size) {

View File

@ -29,6 +29,7 @@
#define CONF_E_PARSE 4
#define CONF_E_OVERFLOW 5 /** <Buffer passed too small */
#define CONF_E_NOCONF 6 /** <No open config file */
#define CONF_E_NOTFOUND 7
extern int conf_read(char *file);

View File

@ -266,7 +266,7 @@ int main(int argc, char *argv[]) {
if(!foreground) {
size = PATH_MAX;
if(conf_get_string("general","logfile",NULL,logfile,&size)) {
if(conf_get_string("general","logfile",NULL,logfile,&size) == CONF_E_SUCCESS) {
err_setdest(logfile,LOGDEST_LOGFILE);
} else {
err_setdest("mt-daapd",LOGDEST_SYSLOG);