Fix for deprecated warnings

Fri, 03 Aug 2018 16:56:55 +0200

author
Chiel Broek <mbse@mbse.eu>
date
Fri, 03 Aug 2018 16:56:55 +0200
changeset 562
119129969d37
parent 561
fcfc3dbe85fa
child 563
ca2fafcf3294

Fix for deprecated warnings

thermferm/rdconfig.c file | annotate | diff | comparison | revisions
thermferm/server.c file | annotate | diff | comparison | revisions
--- a/thermferm/rdconfig.c	Fri Aug 03 16:13:17 2018 +0200
+++ b/thermferm/rdconfig.c	Fri Aug 03 16:56:55 2018 +0200
@@ -1204,7 +1204,7 @@
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%f", &val) == 1)
 		unit->volume = val;
-		xmlFree(key);
+	    xmlFree(key);
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_ADDRESS"))) {
 	    unit->air_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
--- a/thermferm/server.c	Fri Aug 03 16:13:17 2018 +0200
+++ b/thermferm/server.c	Fri Aug 03 16:56:55 2018 +0200
@@ -317,7 +317,7 @@
     char		*opt, *param, *name = NULL, *filename = NULL, *logname = NULL, mbits[11], tstr[24];
     DIR			*dd;
     FILE		*fp;
-    struct dirent	entry, *result;
+    struct dirent	*result;
     ls_list		*lsx = NULL, *tmp;
     struct stat		sbuf;
     struct tm		*tbuf;
@@ -356,12 +356,10 @@
 
 	if ((dd = opendir(name))) {
 	    for (;;) {
-		if ((readdir_r(dd, &entry, &result)) != 0) {
-		    syslog(LOG_NOTICE, "readdir_r: error=%d", errno);
+		if  (! (result = readdir(dd))) {
+		    syslog(LOG_NOTICE, "readdir: error=%d", errno);
 		    break;
 		}
-		if (result == NULL)	/* End of directory	*/
-		    break;
 		if (result->d_name[0] != '.') {
 		    filename = xstrcpy(name);
 		    filename = xstrcat(filename, result->d_name);

mercurial