Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.

Fri, 01 Aug 2014 09:25:38 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 01 Aug 2014 09:25:38 +0200
changeset 166
c31ea86fec43
parent 165
e97829d0f8f9
child 167
56b008563db8

Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.

thermferm/devices.c file | annotate | diff | comparison | revisions
thermferm/rdconfig.c file | annotate | diff | comparison | revisions
--- a/thermferm/devices.c	Thu Jul 31 23:57:04 2014 +0200
+++ b/thermferm/devices.c	Fri Aug 01 09:25:38 2014 +0200
@@ -116,6 +116,7 @@
 		}
 	    }
 	}
+	closedir(fd);
     }
 
 #ifdef HAVE_WIRINGPI_H
@@ -250,6 +251,7 @@
 				    syslog(LOG_NOTICE, "sensor %s CRC error", device->address);
 				    device->present = DEVPRESENT_ERROR;
 				}
+				fclose(fp);
 			    } else {
 				if (device->present != DEVPRESENT_NO) {
 				    syslog(LOG_NOTICE, "sensor %s is missing", device->address);
--- a/thermferm/rdconfig.c	Thu Jul 31 23:57:04 2014 +0200
+++ b/thermferm/rdconfig.c	Fri Aug 01 09:25:38 2014 +0200
@@ -114,7 +114,8 @@
 
 
 
-int wrconfig(void)
+int do_wrconfig(void);
+int do_wrconfig(void)
 {
     int			rc = 0;
     FILE		*fp;
@@ -563,6 +564,17 @@
     fclose(fp);
     xmlBufferFree(buf);
 
+    return 0;
+}
+
+
+
+int wrconfig(void)
+{
+    int		rc;
+
+    rc = do_wrconfig();
+    syslog(LOG_NOTICE, "Rewritten configuration, rc=%d", rc);
     return rc;
 }
 

mercurial