From a25a7062bff47f689c0e77a5f1696767db70c095 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Sat, 8 Oct 2011 17:16:30 +0000 Subject: [PATCH] Safe write for nodes.dat --- .svn-revision | 2 +- src/kademlia/routing/RoutingZone.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.svn-revision b/.svn-revision index 4319db81..92799cc0 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10636 +10637 diff --git a/src/kademlia/routing/RoutingZone.cpp b/src/kademlia/routing/RoutingZone.cpp index b190badf..12536552 100644 --- a/src/kademlia/routing/RoutingZone.cpp +++ b/src/kademlia/routing/RoutingZone.cpp @@ -310,7 +310,7 @@ void CRoutingZone::WriteFile() try { unsigned int count = 0; CFile file; - if (file.Open(m_filename, CFile::write)) { + if (file.Open(m_filename, CFile::write_safe)) { // Start file with 0 to prevent older clients from reading it. file.WriteUInt32(0); // Now tag it with a version which happens to be 2. @@ -333,6 +333,7 @@ void CRoutingZone::WriteFile() c->GetUDPKey().StoreToFile(file); file.WriteUInt8(c->IsIPVerified() ? 1 : 0); } + file.Close(); } AddLogLineN(CFormat(wxPLURAL("Wrote %d Kad contact", "Wrote %d Kad contacts", count)) % count); } catch (const CIOFailureException& e) { -- 2.11.4.GIT