mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
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:
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user