Minor optimization for setupVars.conf interpreter

This commit is contained in:
DL6ER
2017-03-27 22:10:02 +01:00
parent 0429b19064
commit 5b4cdc5ce3
2 changed files with 8 additions and 2 deletions
+4 -2
View File
@@ -10,15 +10,16 @@
#include "FTL.h"
FILE *setupVarsfp;
char ** setupVarsArray = NULL;
void check_setupVarsconf(void)
{
FILE *setupVarsfp;
if((setupVarsfp = fopen(files.setupVars, "r")) == NULL)
{
logg("WARN: Opening of setupVars.conf failed!");
logg(" Make sure it exists and is readable");
logg_str(" Message: ", strerror(errno));
}
else
{
@@ -45,9 +46,10 @@ char * linebuffer = NULL;
char * read_setupVarsconf(const char * key)
{
FILE *setupVarsfp;
if((setupVarsfp = fopen(files.setupVars, "r")) == NULL)
{
logg("WARN: Reading setupVars.conf failed!");
logg_str("WARN: Reading setupVars.conf failed: ", strerror(errno));
return NULL;
}
+4
View File
@@ -176,6 +176,10 @@ void *connection_handler_thread(void *socket_desc)
{
char *message = calloc(strlen(client_message)+1,sizeof(char));
strcpy(message, client_message);
// Clear client message receive buffer
memset(client_message, 0, sizeof client_message);
// Lock FTL data structure, since it is likely that it will be changed here
// Requests should not be processed/answered when data is about to change
enable_read_lock(threadname);