Search for readable config file in alternative location in case the default path is not available.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-11-07 16:21:00 +01:00
parent e744e086b8
commit 7fc77c67a2
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -93,6 +93,7 @@ enum { BLOCKING_DISABLED, BLOCKING_ENABLED, BLOCKING_UNKNOWN };
// Static structs
typedef struct {
const char* conf;
const char* conf2;
const char* log;
const char* pid;
const char* port;
+2 -1
View File
@@ -21,7 +21,8 @@ void read_FTLconf(void)
FILE *fp;
char * buffer;
if((fp = fopen(FTLfiles.conf, "r")) == NULL)
if(((fp = fopen(FTLfiles.conf, "r")) == NULL) &&
((fp = fopen(FTLfiles.conf2, "r")) == NULL))
{
logg("Notice: Found no readable FTL config file");
logg(" Using default settings");
+3
View File
@@ -11,7 +11,10 @@
#include "FTL.h"
FTLFileNamesStruct FTLfiles = {
// Default path for config file (regular installations)
"/etc/pihole/pihole-FTL.conf",
// Alternative path for config file (snap installations)
"/var/snap/pihole/common/etc/pihole/pihole-FTL.conf",
"/var/log/pihole-FTL.log",
"/var/run/pihole-FTL.pid",
"/var/run/pihole-FTL.port",