Cleanup, dead code removal, some pretty insignificant security stuff that's based on recommendations.

This commit is contained in:
Adam Ierymenko 2014-04-18 00:14:12 -07:00
parent 5f45977e3e
commit 7831c4bfef
6 changed files with 31 additions and 33 deletions

View file

@ -239,13 +239,16 @@ void Topology::_dumpPeers()
if (fwrite(buf.data(),buf.size(),1,pd) != 1) {
fclose(pd);
Utils::rm(pdpath);
buf.burn();
return;
}
buf.clear();
buf.burn();
}
} catch ( ... ) {
fclose(pd);
Utils::rm(pdpath);
buf.burn();
return;
}
}
@ -254,12 +257,15 @@ void Topology::_dumpPeers()
if (fwrite(buf.data(),buf.size(),1,pd) != 1) {
fclose(pd);
Utils::rm(pdpath);
buf.burn();
return;
}
buf.burn();
}
fclose(pd);
Utils::lockDownFile(pdpath.c_str(),false);
buf.burn();
}
void Topology::_loadPeers()
@ -301,6 +307,7 @@ void Topology::_loadPeers()
fclose(pd);
Utils::rm(pdpath);
buf.burn();
}
} // namespace ZeroTier