kopia lustrzana https://github.com/cyoung/stratux
added some sync calls to store settings more reliably on power loss
rodzic
01b474966e
commit
6800e71652
|
@ -1316,6 +1316,7 @@ func saveSettings() {
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
jsonSettings, _ := json.Marshal(&globalSettings)
|
jsonSettings, _ := json.Marshal(&globalSettings)
|
||||||
fd.Write(jsonSettings)
|
fd.Write(jsonSettings)
|
||||||
|
fd.Sync()
|
||||||
log.Printf("wrote settings.\n")
|
log.Printf("wrote settings.\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1369,6 +1370,7 @@ func saveWiFiUserSettings() {
|
||||||
fmt.Fprintf(writer, "wpa_passphrase=%s\n", globalSettings.WiFiPassphrase)
|
fmt.Fprintf(writer, "wpa_passphrase=%s\n", globalSettings.WiFiPassphrase)
|
||||||
}
|
}
|
||||||
writer.Flush()
|
writer.Flush()
|
||||||
|
fd.Sync()
|
||||||
}
|
}
|
||||||
|
|
||||||
func openReplay(fn string, compressed bool) (WriteCloser, error) {
|
func openReplay(fn string, compressed bool) (WriteCloser, error) {
|
||||||
|
|
|
@ -146,4 +146,5 @@ func writeTemplate(tplFile string, outFile string, settings NetworkTemplateParam
|
||||||
log.Printf("Network Settings: Unable to execute template substitution %s: %s", outFile, err)
|
log.Printf("Network Settings: Unable to execute template substitution %s: %s", outFile, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
outputFile.Sync()
|
||||||
}
|
}
|
Ładowanie…
Reference in New Issue