Fix bogus error messages on web config

This commit is contained in:
Ron Pedde 2007-10-23 04:23:50 +00:00
parent 60f8d1299f
commit fffe34e5eb
3 changed files with 15 additions and 7 deletions

View File

@ -1109,6 +1109,7 @@ int conf_set_string(char *section, char *key, char *value, int verify) {
err=_conf_verify_element(section,key,value);
if(err != CONF_E_SUCCESS) {
util_mutex_unlock(l_conf);
DPRINTF(E_DBG,L_CONF,"Couldn't validate %s = %s\n",key,value);
return err;
}
@ -1276,18 +1277,19 @@ int conf_write(void) {
* @param fp file we are writing the config file to
* @param pll list we are dumping k/v pairs for
* @param sublevel whether this is the root, or a subkey
* @returns TRUE on success, FALSE otherwise
* @returns CONF_E_SUCCESS on success, failure code otherwise
*/
int _conf_write(IOHANDLE hfile, LL *pll, int sublevel, char *parent) {
LL_ITEM *pli;
LL_ITEM *ppre, *pin;
LL_ITEM *plitemp;
int first;
int err;
char keybuffer[256];
if(!pll)
return TRUE;
return CONF_E_SUCCESS; /* ?? */
/* write all the solo keys, first! */
pli = pll->itemlist.next;
@ -1330,9 +1332,9 @@ int _conf_write(IOHANDLE hfile, LL *pll, int sublevel, char *parent) {
}
io_printf(hfile,"\n");
if(!_conf_write(hfile, pli->value.as_ll, 1, pli->key)) {
if((err =_conf_write(hfile, pli->value.as_ll, 1, pli->key)) != CONF_E_SUCCESS) {
DPRINTF(E_DBG,L_CONF,"Error writing key %s:%s\n",pli->key);
return FALSE;
return err;
}
}
break;
@ -1364,7 +1366,7 @@ int _conf_write(IOHANDLE hfile, LL *pll, int sublevel, char *parent) {
}
}
return TRUE;
return CONF_E_SUCCESS;
}

View File

@ -427,7 +427,7 @@ int main(int argc, char *argv[]) {
configfile="mt-daapd.conf";
}
if(conf_read(configfile) != CONF_E_SUCCESS) {
if(CONF_E_SUCCESS != conf_read(configfile)) {
fprintf(stderr,"Error reading config file (%s)\n",configfile);
exit(EXIT_FAILURE);
}
@ -437,7 +437,7 @@ int main(int argc, char *argv[]) {
if(convert_conf) {
fprintf(stderr,"Converting config file...\n");
if(!conf_write()) {
if(CONF_E_SUCCESS != conf_write()) {
fprintf(stderr,"Error writing config file.\n");
exit(EXIT_FAILURE);
}

View File

@ -139,8 +139,10 @@ void xml_update_config(WS_CONNINFO *pwsc) {
*ptmp++ = '\0';
/* this is stupidly inefficient */
DPRINTF(E_DBG,L_XML,"Setting %s/%s to %s\n",duparg,ptmp,value);
err = conf_set_string(duparg,ptmp,value,TRUE);
if(err != CONF_E_SUCCESS) {
DPRINTF(E_DBG,L_XML,"Error setting %s/%s\n",duparg,ptmp);
has_error = TRUE;
if(!badparms) {
badparms_len = (int)strlen(arg) + 1;
@ -170,6 +172,8 @@ void xml_update_config(WS_CONNINFO *pwsc) {
return;
}
handle = NULL;
/* now set! */
while((handle=ws_enum_var(pwsc,&arg,&value,handle)) != NULL) {
/* arg will be section:value */
@ -179,9 +183,11 @@ void xml_update_config(WS_CONNINFO *pwsc) {
*ptmp++ = '\0';
/* this is stupidly inefficient */
DPRINTF(E_DBG,L_XML,"Setting %s/%s to %s\n",duparg,ptmp,value);
err = conf_set_string(duparg,ptmp,value,FALSE);
if(err != CONF_E_SUCCESS) {
/* shouldn't happen */
DPRINTF(E_DBG,L_XML,"Error setting %s/%s\n",duparg,ptmp);
xml_return_error(pwsc,500,arg);
return;
}