Fix Rpi config file corruption

* Add uninstall to Makefile
This commit is contained in:
Marcelo Aquino
2016-08-22 21:26:44 -03:00
parent 412e41967f
commit f0c5a993d5
5 changed files with 30 additions and 7 deletions
+3 -2
View File
@@ -90,12 +90,13 @@ void hwWriteConfigBlock(void* buf, void* addr, size_t length)
if (length && offs + length <= _length) {
memcpy(_config+offs, buf, length);
std::ofstream myFile(CONFIG_FILE, std::ios::out | std::ios::binary);
std::ofstream myFile(CONFIG_FILE, std::ios::out | std::ios::in | std::ios::binary);
if (!myFile) {
debug("Unable to write config to file %s.\n", CONFIG_FILE);
return;
}
myFile.write((const char*)buf+offs, _length);
myFile.seekp(offs);
myFile.write((const char*)buf, length);
myFile.close();
}
}