mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 06:05:56 -05:00
Fix bogus error messages on web config
This commit is contained in:
parent
60f8d1299f
commit
fffe34e5eb
12
src/conf.c
12
src/conf.c
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user