Write+move instead of rewrite for dnsseed.dat

This commit is contained in:
Pieter Wuille 2012-09-30 22:02:41 +02:00
parent 849daecd05
commit 2c1cd71d39

View file

@ -270,11 +270,14 @@ extern "C" void* ThreadDumper(void*) {
do {
Sleep(100000);
{
FILE *f = fopen("dnsseed.dat","w+");
FILE *f = fopen("dnsseed.dat.new","w+");
if (f) {
{
CAutoFile cf(f);
cf << db;
}
rename("dnsseed.dat.new", "dnsseed.dat");
}
FILE *d = fopen("dnsseed.dump", "w");
vector<CAddrReport> v = db.GetAll();
sort(v.begin(), v.end(), StatCompare);