blob: be87bf883049c874d1308fcf3f3953d0bcd6376d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
On OpenWrt targets the tmp filesystem is wiped upon power cycle, so files
requires to be created.
--- a/service/SettingsConfuse.cpp
+++ b/service/SettingsConfuse.cpp
@@ -436,6 +436,13 @@ bool readVarConfig(cfg_t **cfg) {
FILE *fp = fopen(VAR_CONFIG_FILE, "re"); // e for setting O_CLOEXEC on the file handle
if (!fp) {
(*cfg) = 0;
+ fp = fopen(VAR_CONFIG_FILE, "we"); // If missing, create file if possible
+ if(fp) {
+ fclose(fp);
+ }
+ else {
+ Log::warning("Unable to create var config file, %s", VAR_CONFIG_FILE);
+ }
Log::warning("Unable to open var config file, %s", VAR_CONFIG_FILE);
return false;
}
|