Wed, 19 Aug 2015 22:09:17 +0200
Create a new configuration file if it doesn't exist.
thermferm/rdconfig.c | file | annotate | diff | comparison | revisions |
--- a/thermferm/rdconfig.c Sat Aug 15 11:27:54 2015 +0200 +++ b/thermferm/rdconfig.c Wed Aug 19 22:09:17 2015 +0200 @@ -1933,20 +1933,15 @@ mypath = xstrcat(mypath, (char *)"thermferm.xml"); if ((doc = xmlParseFile(mypath)) == NULL) { /* - * Not in the users home directory + * No config file, create a fresh one */ - free(mypath); - mypath = xstrcpy((char *)"/etc/mbsepi-apps/thermferm.xml"); + syslog(LOG_NOTICE, "rdconfig: %s not found, creating", mypath); + wrconfig(); + if ((doc = xmlParseFile(mypath)) == NULL) { - /* - * Try /usr/local/etc - */ + syslog(LOG_NOTICE, "rdconfig: could not create %s", mypath); free(mypath); - mypath = xstrcpy((char *)"/usr/local/etc/mbsepi-apps/thermferm.xml"); - if ((doc = xmlParseFile(mypath)) == NULL) { - syslog(LOG_NOTICE, "rdconfig: could not find thermferm.xml"); - return 1; - } + return 1; } } syslog(LOG_NOTICE, "rdconfig: using %s", mypath);