thermferm/rdconfig.c

changeset 388
05a55609cd9a
parent 370
843dc511c877
child 397
00ca08f5a6f8
--- 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);

mercurial