mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Minor optimization for setupVars.conf interpreter
This commit is contained in:
+4
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user